If the job is something with such a steep learning curve and plateau (maybe due to periodic technical revolutions?) that someone with 20 years experience is only insignificantly better than someone with 5 years experience, economics would support paying them the same. If we want to artificially subsidize some more expensive older workers, they should be subsidized directly by society, not by forcing employers to do so.
(There are a lot of jobs where 20 years gives better performance, or where being 51% good va 50% good would be worth a huge premium, but not all.)
Where this really gets complex is startups which are growing in headcount and shrinking in equity offer size. An early hire there might be objectively worse than a new marginal hire but has an equity vesting package which makes him vastly better paid for each month today. IIRC it was Zynga which tried to forcibly renegotiate this (instead of just firing people who were presently underperforming, the usual route).