The boss often has little power or agency to fix it. You have never been a middle manager. The amount of red tape you need to go through to fire someone for cause, cover your ass from lawsuits, etc is overwhelming.
Managers are people too, often struggling because they’re squashed between challenging top down directives and the needs of all their reports.