I'm sorry to hear about your experience in that role. That sounds pretty awful.

That being said, it also sounds like a toxic overall environment, independent from the middle management role (eg. from MoM to (Senior) Director in big corps). Allow me to maybe try and redeem the role just a little bit.

By my own metric, I've been in middle management for over a decade now, and by most accounts probably pretty successfully so. Here's a couple of take aways for folks who are thinking about such a career path. I don't think any of this would've salvaged your situation though.

- Even more so than a line manager, you will benefit greatly from becoming good at transitive gratification. Learn to see other folks' (usually your team) success as a source for your own happiness and achievements.
This has both contributed to my sense of achievement and happiness but also helped me learn that credit being split is usually still worth more than half.

- Appreciate the challenge. I've walked into problematic teams/organizations more than once, full knowing, because I wanted the challenge. Sometimes I succeeded and the teams became happier and more productive (which often has causation in either direction). Sometimes I most decidedly did not succeed. It's just like with technical challenges that way. Just try to gauge whether or not you have the support to see it through and drive change. Again, just like in a technical project.

- I've had the luxury of largely working in environments where most people, engineers, managers, executives, etc were reasonably competent. It has been rare that execs were true bullshit artists. Obviously that helps, but most importantly it makes the following feasible: be genuine. You can't always provide 100% transparency because context matters, but you can try to get as close as is safe for folks. State your intentions. Never lie. Treat political backstabbing harshly. Just, well, act with integrity. In my experience, with enough tenacity, this eventually makes it much easier to have your teams' respect. Knowing you can get transitive gratification makes that so much easier. This probably breaks down at the latest around an org size of several hundred where folks can't experience you as an individual anymore.

- Be a bit of a shit umbrella but not in a load bearing way. This is a special case of the previous point - if you try to protect your teams from the latest executive fire drill, but for some reason you fail to deliver on it while insulating the teams right up to the breaking point, it'll be so much worse when it all punches through at once. Equally, you won't get the thing done that is required, eroding your own management chain's trust in you. Bonus: by being transparent to your leads and involving them gently, you give them an opportunity to practice your succession.

- Do not skimp on performance management. Be principled. Don't play favorites. Give feedback early. Be empathetic in how you deliver it, and how you act on it. But don't let that be your excuse for not doing it consistently. It's hard. Exhausting. Often awkward when either party isn't used to giving/receiving it. But it's not unkind or doesn't have to be. Having had a great manager who was willing to give me difficult feedback has saved me from failure more than once. When one of my reports, whom I had done a PIP with, got promoted a few years later, I was happier than if I had been promoted myself. If you do this well, folks on your teams will better understand expectations. If you do it with empathy, they will build trust in you. Good people from elsewhere will be happy to join your teams because they see folks' development. It really can be a virtuous cycle.

- Develop a keen sense for how power distance changes relationships. Treat people with respect regardless of their seniority or lack thereof. That 23 year old intern also brings their unique experiences. Never talk down on anybody. But also never forget that power distance creates severely imbalanced relationships. As much as it may pain you, be very careful about becoming personal friends with your reports. It can work, and has worked for me many times, but there's little more crushing than learning that it was less than genuine. They themselves may not even realize it at the time.

- The move from engineering manager to indirect manager is, for many people, more subtly challenging than when they first became a manager to begin with. It's an insidious change where you can get away with little adjustment of approach for a while. That's usually a straight path to become a horrible micromanager. (Been there, learned the lesson.) I must have asked nearly a hundred candidates in interviews about how they experienced this transition and this is by far the most common pitfall. Instead, build out a trust-but-verify approach, letting go of some details, giving your leads leeway to explore solutions, while creating a set of metrics and controls/reviews that will alert you when you need to step in to help.

That all being said, in the spirit of this thread, I've made a lot of mistakes along the way, and continue to do so. Some mistakes I regret (others I recognize as source of learning). The management mistake I probably make the most frequently is: not doing performance management early/consistently enough. If you let it go for a while because it's exhausting, or because you're not confident enough, or simply because it's no fun, then it just becomes more and more difficult and unkind to the recipient. I still fall into this trap sometimes. Is it their performance? Or are my expectations just not calibrated in this new org I just moved to? ...

But the biggest, most hurtful mistake so far surely has to be a case where my instinct had told me that somebody was toxic, but my hubris won out, thinking I can salvage them for their talent. It even appeared to work for a while, my hubris making me provide them with increasing amounts of sponsorship, which they reciprocated with ever increasing success (they did have talent). Fast forward another year, I've allowed myself to think of them as a friend. Transitive gratification goes into overdrive. Finally managed to establish them as a peer, splitting my own organization in half. The day they became a peer, they basically stop talking to me. Within a month our now mutual manager concludes that the person wasn't ready (did I mention that I over-sponsored them?) and folded their org back into mine. Toxicity back in full swing. Eventually they rage quit by deliberately (I think) getting themselves fired for talking about internals on Twitter. On the way out, they blamed me for all bad things. Wow, did I mess that up, good intentions be damned. Hope they're alright now.

Anyway, I hope that there's still folks willing to try out a middle management role for the right reasons. We all deserve better management. :)