The problem likely goes all the way to the board of directors who should hold the CEO accountable to build a culture that doesn't let bad managers exist in the org (by coaching or removing them).
A lot of companies have this problem, and it's a major dysfunction, but make no mistake, it's :bad: managers you have a problem with, not "pure" ones. I know a ton of great non-tech leaders who do amazing work of leading technical teams because they build the team around that. You get the lead engineer(s) to run the tech leadership while empowering them with autonomy / resources / support and holding them constantly accountable to well defined goals.
Management isn't rocket science, it's just a lot of hard work and discipline. It is its own craft and a very challenging and rewarding one if it suits you.
Bad leaders can ruin great teams and great leaders can turn around weak teams. I've seen/done it myself. Without fail, when I switch out a weak manager for a better one, the team improves. When groups have no manager they might produce, but usually not well or as well as they could.
Management isn't around because some conspiracy made by managers to perpetuate themselves, but because it works. No effective group of people is truly leaderless.