This is all correct but the places I've worked at all had the same problems already:
> Maybe you won't get on with your new manager
Manager turnaround (one per year) because they leave or get promoted is pretty common. In fact the better the manager the quicker they seem to move on to some other team or higher up that has more potential for impact.
> or team-mates
Engineers don't have that much influence on hiring decisions. And even then, it sometimes turns out they may need more hand holding than expected or maybe that you don't get along on a personal level. So the risk is here even if you stay at a company.
> Maybe the codebase is a tech-debt spaghetti nightmare.
Let's be honest, it almost always is like that even where one works right now. But I agree it can be worse than what you are dealing with at the moment.
I think the difference is in attitude to address the issue as well. This is indeed really hard to assess ahead of time. In my last job I thought we had a good attitude towards recognizing tech debt for the first few months, then realized it's not the case and all plans to address it soon appeared to be just empty talk.
> You can't carry over the reputation and clout
Yeah, definitely. Unless you have built a public reputation in the industry.
In the general case you will indeed have to build new reputation in the new place. But often that's also an opportunity for those who failed to succeed at that in their current environment. So it's only a risk if you have something to hold on to.
I believe the risks of moving jobs are likely outweighed by the higher pay check and experience to gain in the new place. A few companies even allow you to come back (given available headcount) if you actually are someone with clout and a record of high impact work. So the risk for those folks is likely not that significant.
I think the bottom line is still that folks don't leave "just for the money". There needs to be some promise of the new job providing something you are not getting now. For successful long timers it's often just "got bored with being in the same place".
The risk of not getting experience at some places is also not to be ignored. It's a balance of course but if you have a few 3 year stints at good companies with some tangible output wrt impact to talk about it's usually better than spending 12 years at one place. Eventually you might end up having to move, and then you'll not have as much salary to expect (or the confidence to ask for it) compared to those who played the job change game.