My first tiel Sunny passed away at 20. My 2 tiels now are 23 and 33- Scooter and Rosie. Sunny was a pied, as is Scooter. Rosie is a normal grey. Every tiel that I have heard of living a long time have been one of those two mutations.
I think breeding does play a part to a certain degree. Sunny came to us at 15. I traced his leg band to a breeder registered with a national cockatiel breeder association. Scooter has all the markings of a "show bird". Yes, there are such a thing. Lol. He has an amazing crest and straight wings. So I think he came from a knowledgeable breeder.
A lot of pet store birds seem to come from the equivalent of puppy mills. So in that case yes I think poor breeding will shorten their life span. Proper diet is very important too. But Sunny had a poor diet until we got him and he lived to 20. So I think it's a combination of things.