"The fact that most engineers are young is much more to do with the numbers in the profession doubling every five years in the last twenty years imho. If you were an engineer twenty years ago, there are now sixteen times more engineers. Your peer group is going to look pretty small therefore. All of these younger engineers are going to get older too of course, and the demand won't keep on growing at this rate, so inevitably the ratio of young vs old devs will even out."
https://news.ycombinator.com/item?id=28294734
I don't deny that there are other factors but this simple numerical fact accounts for a lot. The vast numbers of 20 and 30 something developers around now are not all going to become consultants, managers, founders.