I wouldn’t recommend staying with a company for 17 years. That’s for sure. Best way to get stuck in a company specific niche skill that is not transferable. For the reasons stated you got to keep yourself positioned well skills wise and relevant so you can jump into any role you need at any time.
Integrity is not for the company. It’s doing things the way you think they should be done and earn your own respect.
I would say all companies don’t replace with cheaper. Many do. Especially the shitty ones. It’s quite easy to avoid those like the plague. Many did, and learnt the hard way, many have staff that have seen failed outsourcing and are in a position to influence that.
Soloing knowledge doesn’t keep you safe though as the penny pinching companies will remove anyway and clean up later regardless. It does not keep you safe. It’s a false sense of security. Complacency is a death sentence in software development.
I mean it isn’t. Progressivism only seems to exist as a word in America, because the USA has the red scares, and conflates communism and socialism, and so are scared of the phrase and had to reinvent their own.
In Europe, you have Conservatives (right wing market, socially conservative), Liberals (free market, but with positivity towards social reforms). Socialism or Democratic Socialism (positive social reforms, state involvement, but with democracy). Communism (economic distribution but more autocratic), and Social Democratic (somewhere between Liberal and Democratic Socialist). Socialism is where you’re willing to consider the state getting involved in wealth redistribution.
It’s better you understand political philosophy and how it is used and applies around the world to truly understand it. You cannot understand the spectrum, if you cannot zoom out from the Overton window.