At least in "corporate America", middle managers are often the first to go in layoffs because it's harder to directly attribute their work to the end product. And a higher salary puts a target on your back. It's harder to let go of the folk who are actually building your product without having an immediate impact.
When I think of layoffs benefiting the business by cutting underperformers, I imagine that as lot of those underperformers can be found in middle management.
If you are a talented manager, you are likely to be headed for further promotion, not waiting for the firing line. I guess it's more of an up or out situation, if that's what you were thinking.
I think it's just harder to get a clear signal of the value that each manager is delivering. Sure there are some headed for promotion, but deciding between an average and underperforming manager can be a tougher call. And getting rid of one just means that all their ICs get reassigned to some other manager, but the immediate impact to projects/deliverables is probably pretty minimal in the short term at least.
Changing managers throws a team into mayhem for the short term. But if the manager wasn't getting results anyway, it obviously pays off very quickly.
I think like any profession, there is a spectrum, and the better you understand the skills, the clearer you can assess them. It takes a little longer for a manager's performance to play out, but underperformance is just as clear as undelivered or bad code. If the team is unhappy and results are inconsistent, the manager is to blame (fairly or not, which is part of the job).