The amount of toxicity on Stackoverflow seemed (to me), to depend on the language and the “leaders” in those language communities.
For example c# had users like Jon Skeet, Marc Gravell and Erik Lippert (and various others) and they set the tone and the professionalism.