It is rational in the head of executives who see developers as code monkeys toying with a keyboard in between 2 games of Magic The Gathering.
Senior people are more expensive, companies see programmers as a utility and don't want to pay 5x for a senior code monkey while they can pay 0.5x for a junior code monkey, period.
But that's the point, the economy behind it is not obvious.
It is more often a cultural thing when 20-somethings working on their startup don't want a daddy to hang around with them. Corporations with strictly formal hiring procedures are usually less ageist.
Senior people are more expensive, companies see programmers as a utility and don't want to pay 5x for a senior code monkey while they can pay 0.5x for a junior code monkey, period.