Not to discredit the real ageism that exists, but far more often I think its the fact that older, saltier people are going to demand a higher wage, more work life balance, and see through bullshit easier. All of those things are negatives for a middle manager trying to fill a role. That's right, they become more focused on the task of filling a role than about solving the companies issues.
I'd wager that if you got old farts to agree to the same bullshit terms pushed on younger people because they missed Legal Contracts 101, the gap would shrink.
What's funny to me is that a contractor I was the dude picking up the pieces after the technical debt inevitably bit them in the ass, so in the long run companies that make decisions like that end up paying more for them.
I actually gave up my share of my first startup because it was built on exploiting this fact, and I felt a proper counciling of the customer would include something along the lines of "we are more expensive than a full time person, but do less than a tenth of the work of one since we split our time between many clients, therefore we should be a temporary stopgap and a continuing advisory position", which obviously didn't go well for an msp style it support company.
I'm increasingly convinced the business world is full of short sighted incompetence.