It's not helping that in the last 10 years a culture of job-hopping has taken over the tech industry. Average tenure at tech companies is often ~2 years and after that people job hop to increase compensation.
It's clear why people do it (more pay) but it sets up bad incentives for the companies. Why would a company invest money in growing the technical skill set of an employee, just to have them leave as soon as they can get a better offer?
When I'm hiring an engineer, HR will easily let me bump up the offer by $10-20K if the candidate counters. It is nearly impossible to get that same $10-20K bump for an existing engineer that is performing extremely well. Companies themselves set up this perverse incentive structure.
Funny, I was at my previous company almost exactly two years. They never even gave me a cost of living increase, much less a "raise." So I was effectively earning less each year. Change needs to happen from both sides if extended tenure is the goal.
People have been saying this for at least 30 years.
Why didn't companies just grant raises more aggressively? Was the ease of poaching engineers not a clear market signal?
One would assume the solution is to simply offer a good package and retain employees with that. I returned to an old company after a few years of floating around because I realized they had the perfect mix of culture and benefits for me, even if the pay isn't massive.
You're falling for the exact same fallacy experienced by failed salesmen. "Why would I bother investing time in this customer when they're just going to take my offer to another dealership for a better deal?"
Answer: you offer a good deal and work with people honestly, because if you don't, you'll never get a customer.