Its directly ageism. Because it happens as soon as you hit 40. Sports has the same thing. So does the military (passed over 3 times for promotion in x amount of years, you leave the military).
Military does it for competence. Sports does it for physical reasons. But is there a reason to throw away 20+ years of experience in an engineer, so you can cut payroll? Particularly when those engineers built the industry, your busy making unicorn-money off of?
The whole thing is ridiculous.