IDK, I think it's to enforce pecking orders based on stuff you can't at all help. I grew up working class and hated it--it's essentially bullying, no matter how you look at it.
It's one thing to make lighthearted jokes about some stuff you did, like "remember the time you forgot to base64 decode the images and stored garbage in the DB". It's entirely another to bully people for who and what they are. You're basically daring people to get somehow violent with you to get you to stop, and besides that being dangerous, a lot of people would rather not. It also creates this dynamic where people willing to be violent avoid bullying and rise ok the pecking order, and those who aren't don't.
How did I get my promotion that made the job worthwhile? A person fell 30 feet onto concrete. The next week, I was replacing him, with all of the risks he had, and the potential outcome.
That said, all of the chiding and sideways comments I received in the construction field didn't amount to half of the comments I received as a developer. There is something toxic about our field that we don't want to focus on (and I can't blame those that look away).
People claim "simple" when they mean "my way". People claim lack of "knowing how to use the language" when the wrong ideas get injected into a language (I'm personally looking at you Perl, but now that I'm working Golang, it's starting to feel too familiar).
The truth is, there is often more than one way to solve a problem, but an strong willed person won't see it that way. I've walked away from plenty of marginally (and I mean marginally) better solutions just to compromise to some form of a solution than I care to enumerate. One can't win such arguments.
I agree, it's not malicious, but is is egotistical. I've even won solutions where I said "Let's all agree that you're right, and then let's accept the code as-is." This industry is improved compared to decades before, but it's not yet fully rational, or even fair.