I've been in a position where my abilities vastly out stripped those of the rest of the team. I was insecurely seeking praise and adoration by fixing as many problems with the code as quickly as I could.
The mistake, in my opinion, that I made was that I did it alone.
I didn't communicate with team and work with them at their pace. I blasted ahead and did all the work myself. And it didn't win me any friends.
They were angry, very angry. They thought I made them look bad and I was being negatively critical of their work. They got defensive and stopped listening to the why and how of my changes.
When there's a huge skill impedence mismatch between you and the team of your peers you especially need to consider their feelings. Had I approached the situation by reaching out and explaining my ideas in a way that they understood and guided them along to the solution, I would have had a different outcome. They needed to be part of the solution even if I didn't agree with them completely.
I needed to accept and believe in myself and not go looking for praise from them. I needed to recognize that they spent their own time and effort on this work. Maybe they were lazy, maybe they didn't know better, or maybe they were too busy to write a performant solution, but the work was partly theirs and I needed to consider that. The best way to do that was to talk to them and listen.
More recently I have been more guiding and taken the team with me to a solution. I've had much better success with this. Sure it's slower. Sure I ended up with work that was good but not exactly how I wanted it. But I gained something I hadn't expected: a stronger bond with the team, knowing they would listen to me and I to them, and that we all respected each other. We also ended up producing better work as a team.
I'm not saying any of this to discredit toxic work environments. I've been on broken teams before where everyone is turned against each.
Part of the responsibility for this lies with the leadership individuals who matched someone with skills out pacing the rest of the team, placing them as a peer on the team. They should have considered the team dynamics they were creating.
You can help reduce the toxicity of your work environment by considering your impact on a team and how you work with them. Being "right" about the work is seldom the only factor to consider and does not absolve you of ignoring the thoughts, ideas, and feelings of others.