You can usually get away with either being insufferable but delivering, or faffing around with an air of pleasant cooperative helpfulness. But not both. I strongly suspect he was delivering what he thought people "really" wanted, not what they asked for or needed, and that made it easy to get rid of him when he annoyed people.
(Also, team composition really does follow TVtropes narrative rules. You need a balance of character archetypes and you can't have two divas.)
If you start somewhere and disagree with the programming languages or techniques they use, the answer is not to use what you think it's best. The answer is to either go with the company policy, or to try and change it. But not just producing what you think is great code, even though no one else can understand it.
I think outside of a few tech hotspots (and even to a large extent, within them), this is pretty normal, and you can judge this by seeing the pretty terrible average quality of code in most companies.
> https://en.wikipedia.org/wiki/Hanlon's_razor
Being surrounded by stupid people is a very typical situation.