It's never nice to have, and sorry that it occurred, but bad experiences at work can teach you a lot about yourself, about others, and you'll pull more threads of wisdom out of it the more life experience you get.
There are always times where things go off the rails, the key is to keep things in perspective. Burnout is a rough beast, but we can learn a lot through it.
I've been working in IT > 30 years and there are many situations I've been through that I don't like to recall, but I also learn from them and when I see repetitions in behaviors (from anyone) then I'm one step ahead of any potential disaster.
It's experience, hard won experience.
You'll be fine in your next role, and wiser.