I agree with this wholeheartedly, as someone currently going through a similar experience.
Management is an incredibly complex job, especially in software engineering, and the fact that we "promote" senior developers to it as if being a good developer was the only requirement to being a good manager is part of the issue in my opinion.
I'm sorry you went through this, and I'm glad you were able to extract some good out of it.