Per your 2nd point about long-term management problems, no doubt of it at all, but sometimes the new (and sometimes good) management simply inherits what previous mismanagement left behind.
Also perhaps you underestimate the power that programmers in well-bedded-in positions have. They can outright ignore management orders - experience speaking.
But a good post nonetheless, thanks.
In reality they cannot do anything, so they scheme to get rid of people who can. During the battle no useful work is being done.
The people that 'snitch' and feel 'under appreciated', and so on... my experience is they have trouble keeping work, are afraid of being found out, and do what they can to get rid of others who can recognize their lack of skills. I just don't think you'd find as many of those getting hired in the context of the needs of this thread.
Don't forget to also sack the management that looked the other way for years while this situation got where it is.
The zero asshole rule is non-negotiable.
The problem is that management doesn't care about the human cost of their decisions and it causes technical problems.
Not to mention the years where they did not comment, help, document or whatever, and became uncontrollable sounds like a management problem over those years.