Free Society doesn’t benefit much from the hammer that does the nails the best of the best. Society benefits more from the good hammer that finds the right nails to handle. Thus, rewards the latter behaviour more
Sure changing job is good for everyone given that you have the wrong programmer on the wrong post.
Likewise a OK programmer at their present job is worth maybe half a year to 2 year in salary in company or narrow product specific knowledge, for the company.
The way changing company gives raises doesn't make sense for the company losing an employee. The employee is worth more for the prior employer than the new. And the new employer's present employees are worth more than the new.
Instead: being good at doing interviews including "looking the part", being strong negotiators, changing jobs often.