This is the difference between employers who play the game at a low level and employers who play the game at a high level. If you play at a low level, then you view your workers as interreplaceable cogs in the machine. You charge for soda at vending machines and balk at shelling out a few hundred bucks for a ping pong table. Sure, it's "expensive" when people leave, since their replacements are more expensive (not to mention ramp-up costs), but your perspective on your employees is how much they cost you to employ, so you try to keep that number as low as possible for as long as possible.
Higher-level players order dinner to the office every night because they understand that the price of food is so ridiculously cheap compared to the additional productivity that the only way it doesn't make sense is if you manage your employees by what they cost and not by the value of their employment. Higher level players grant their employees large raises without being asked because they understand that defensive raises prevent your employees from searching for new work in the first place. Higher level players understand that loyalty has value, trust has value, and tenure has value.
Are lower-level players rational? Sure. They're also either stupid, or of low enough relative productivity that the market will subsume them soon enough.
Gone are those days when this was straightforward.
My experience has been the opposite, in that sticky jobs are jobs held by people who aren't in demand. There's a balancing act for employers ("brilliant but flighty" is less desirable than "good but sticky") so it's certainly possible to argue that jobs being sticky for less-than-brilliant people is a good thing... but in my experience, jobs aren't sticky because of inertia for brilliant people.
I also expect that the moving around every 2 years meme is pretty influenced by Silicon Valley. It certainly isn't the norm I've seen.
And even for those brilliant people who can get it on the first try, you're taking about 2 months minimum to go through the interview process. If you're someone who doesn't like taking risks, that's a tall order until you've become convinced there is no path to promotion within your company.
True, the other side is if you're trying to hire and pay the same industry salary, people aren't going to move because what's the point? If you're trying to hire a lot of people you have to pay more than average just to get people interested.
Even got promoted to management in one of the two jobs! They would sometimes have to take calls from both jobs with one earbud in each ear connected to each laptop.
The industry the companies were in are not known for employing the best and brightest programmers... so I can understand being able to output enough to keep everyone happy. But it still boggles my mind that they never slipped up and got caught.
Most countries I worked in, anything done after hours, not using company resources, and not in the competition space of the employer is simply allowed. No company would be able to enforce that.
In fact (I have had that happen) if the contract tries to over reach, in particular regarding IP, then that clause could just be made void in court.
I work 40 hours/week at a Big-N, but if I put another 15-20 hours per week into my current job I'd get promoted extremely quickly, and get a bigger raise from that promotion than any "side project" I could come up with.
I don't want to do any of that, and moving companies is still probably the easiest way to get a large raise, but my point stands.
That'd be a very rare circumstance.
In most jobs working 15-20 hours overtime each week only gets you 15-20 hours less for living your own life, nothing else.
At all companies I've been at or have intimately known about, there have been clear guidelines for promotions and examples to look at. These are medium to large companies. FAANG and non-FAANG.
I'm sure you're right in a lot of cases, but I feel like at most software companies I'm not too far off.
From an ethical point of view, maybe. From a rational point of view, maybe not.
Jobs are "sticky" — it's a pain to apply for jobs, arrange interviews, deal with the possibility of getting rejected. And if you do get an offer and accept you will be leaving colleagues that may be friends, risk your position being less stimulating, have to move house and/or deal with a new commute.
There is a very real salary range between "low enough that I'll think about applying for other jobs" and "so low I'll actually start applying for jobs". Employers are aware of this and are paying salaries accordingly. It sucks for everyone in that salary band but — ethics and long-term viability aside — it's still the rational economic choice for employers. Every now and again someone will quit and get their deserved 40% increase, but many will delay leaving for years, or simply put up with it indefinitely, saving employers tons of money.
Of course this may not be the case forever. It seems like recently the cohort of people who find interviewing and changing jobs more tolerable (the so-called "job-hoppers") is increasing in size. If you happen to be a part of this cohort, then congratulations, you're winning the job-market pain-of-change-vs-salary arbitrage game and will enjoy above-average year-on-year salary increases for at least the near future.