Lots of people do things like this though and some are lucky enough to not have issues. Did these fish die at the 3 year mark or did you rehome them?
Betta can often live 5 years and neons can even reach close to 10 and often over that. It's not as common in captivity, again a lot don't receive the space and care they need but they could get well passed 3 years when given proper care.
How often do people keep goldfish in spaces that are too small? So often you hear someone say they had a gold fish in a 5 or 10 gallon tank and they lived a nice long 5 years. When really that's not long for a goldfish at all. They show be about 8-10 inches or more in size and live well over 10 years, closer to 20.
If a fish doesn't reach it's proper adult size because it lacks the space to do so it will shorten it's life span. A fish that is stunted most often dies from organ failure. It's body stops growing but it's organs don't. They just get crashed inside and the fish that seems totally normal suddenly starts acting strange and dies.
I mean no offense with any of this, just some info that many are not aware of and I find just knowing some of these things is enough for people to look at a situation and realize that while in some cases it seems to work for many(like the poor 5 year old gold fish) the reality is it's not really working when you get right in and learn, there are far less fish that it doesn't work for than it does and it could be easily solved if more people just knew.
I'm just of the mind set that you give your fish(or any pet) the best you can. There are more suitable fish to a 5 gallon tank than neons and I would rather choose them and save the neons for a larger more suitable tank. JMO. I've always kept neons in a larger tank and can say they've always made great use of it.