I find it really surprising that you think this happened at all companies you've worked at. In my experience, the difference between good and bad companies was exactly how much they recognised merit and fired bad performers.
Note that "bad performance" is very team specific, if I'm shoved into a spaghetti DS code base and told to not write tests or refactor, then I will definitely end up as a poor performer.
And unfortunately, people being people, lots of managers/leads make decisions based on unexamined emotional states, which tends not to lead to rewarding merit.