I've been saying this for a long time. It's especially true in technology and engineering.
I think the reason why the best way to get a promotion and a raise is to get another job is because once you've been working for a company for a few years your salary and benefits are "pinned" or anchored by HR, and you're only going to be able to advance within their acceptable terms, rates, and limits. There's also a lot more negotiation overhead—you have to spend a lot of effort in making your case for a promotion. Whereas with a new job you start fresh and you can negotiate on fundamental terms.
I think the reason why the best way to get a promotion and a raise is to get another job is because once you've been working for a company for a few years your salary and benefits are "pinned" or anchored by HR, and you're only going to be able to advance within their acceptable terms, rates, and limits. There's also a lot more negotiation overhead—you have to spend a lot of effort in making your case for a promotion. Whereas with a new job you start fresh and you can negotiate on fundamental terms.