You are making a good point on one hand, but on the other hand you seem to have misunderstood me. Let me elaborate:
> For example, after 2.5 years, I am looking for a new job, as the company is simply refusing to make adjustments based on the market prices, even after a promotion, I am making 20 percent less than I should be making right now, and this is not an isolated incident.
OK, that is just one job change. It is not like 5 in 10 years. It becomes increasingly unlikely, that every company you work in behaves like that, the more years and job changes you add. As in 6 jobs in 12 years makes that explanation more unlikely than 2 jobs in 4 years. I think everyone is fine with a few quick job changes. Just don't let it become a pattern. And even then I mentioned, that I would not immediately reject, but caution. I am not seeing, what is ignorant about that, tbh. So yes, if the company does not want to adapt, or pay for experience, then I would not argue against job change. However, also one should consider, that most people make way less money in the job market and that they are not in the position to ask for a raise every so and so many years, just because those years have gone by. Software developers already earn good wages usually, in many areas, and I am not merely talking about the valley or stuff like that. Just compare your wage with nurses and similar.
I am also not arguing about wanting to get paid a proper wage. Maybe I would argue a bit against always wanting more, because you can have more elsewhere. That does not really entitle anyone to "have a right to get paid more". Of course you are free to aim for money rather than solidity, but if you do it frequently, you will one day have to face the consequences. Those being, that people might have a hunch, that you will be gone at the first sign of higher pay elsewhere. (Exaggerating here, ofc.)
But now to the points, where I think you misunderstood me:
> Staying at a company for 10 years either means that the company is the perfect place (then, why are you trying to leave?), [...]
Well, I did use the conjunctive form there. I am not.
> [...] or you just acquired tons of skills in your job that are not transferable to your next job, which both do not look good.
And those are the only 2 options you see? That either skills are not transferable or that it must be the perfect place? Sorry, this is waaay to black and white. It is also possible, that you learn many skills on your job, which are indeed transferable. That is a possibility you do not consider.
> Especially, when the job market is so hot right now, it's either that you can not find a new job after withering your skills, or something unpleasant happened in your perfect company and you are looking your way out.
Why do you automatically assume, that everyone who works somewhere for a longer time has "withered their skills"? It's non-sense in that generality.