The irony is that these companies will make you sign & enrol trainings for "code-of-ethics" and the same management will indulge into shady practices (like the OP mentioned). Btw, there are other ways to get rid of employees which do not even need PIP.
I have made peace with the fact employees are just means to an end. Always have been. Nothing less or nothing more. The power is extremely lopsided in favour of the companies. This makes so many things beyond the control of an individual [1]. Focus on things in your control:
1. Keep learning
2. Be debt free as soon as possible.
3. Invest and build a financial cushion
4. Eat healthy and exercise (I am pretty bad at this but trying to improve)
5. Develop an alternative skill(s) which can you put to use if needed
6. Never burn the bridges, no matter what.
All of the above are easier said than done but I see no sustainable way of coping up.
[1] My current employer (which is a listed company) got acquired by a private equity. I have no idea what will happen but I am relaxed.
My advice to protect yourself is just the usual - "manage up". Build a good relationship with your manager (and preferably their manager) and do what you can to confirm that the work you're doing is seen as impactful to their goals. It won't 100% protect you, as sometimes there are circumstances outside their control too, but if you have a good relationship, they will fight to keep you.
Very common.
Your career is 90% politics and 10% skills. Junior devs enter the field thinking this is meritocracy but it is not. Until they realize the truth, their egos will keep getting hurt.
This might be true in companies with awful, cut throat cultures, but it's far from ubiquitous across the industry and worldwide. Meritocracy in software is very real and being good often helps politically. That's just less true for the big companies where you're just a number.
I have been in the industry for a long time. I used to believe this too.
In smaller companies where your work is very visible, your work will matter more. But I have seen plenty of examples where nepotism or favoritism got less qualified people in key roles while highly productive developers got stuck as low level ICs. Some developers don’t play career games and they want to stay ICs which is understandable. But I have never seen the best developer being promoted to key roles without them focusing on office politics, boosting about their work, and starting pet projects to help with promotion packet.
Industry needs to give an illusion of meritocracy in order to extract maximum productivity from fresh recruits. Otherwise, everyone would spent their playing politics game and no work will ever be done.
You do need to delineate between the end goals of promotion and job security, though.
If your only goal is to make money and be promoted then yes, politics are necessary. But that developer who is doing all of the work on the bottom rung and who is required for the team to operate, they often have power and job security. They're kept where they are, and are secure, because of their skills.
That might not be true of a Meta who has billions of dollars to throw at devs. But for companies with a hard time recruiting being good means power.
The old adage goes that there are two people with power in the software industry: those signing the cheques and those writing the code.