I've been watching Uncle Bob videos lately and he's stated in a number of them that the population of developers has doubled every 5 years basically since the beginning.
Which means that half of developers have less than 5 years experience.
We are just outnumbered by the new kids. But there also usually aren't enough of them to fill all of the seats.
I guess it is more a question what is wrong with humanity ... despite all progress, what matters most to most people is, how does someone looks.
And it sure does tells a lot, but not at all enough.
Of course it does cost something. If there is unjustified ageism, then the market value of older people is lower than it should be. In this case, hiring a younger person will cost you more if adjusted for output.