Playing office politics right is the most important thing at work. Doing real work is secondary. On other hand as a workhorse I punch occasionally every management’s darling in the face. They don‘t like me, but they know, that somebody must do technical heavy lifting. Of course, I am number one in the layoff’s list :-)
I understand the negative perception around the importance of playing "office politics", but realistically when people are working as a team it's important people can be cooperative, and office politics is mostly just the exercise of being a cooperative member of the team.
99% of the time people are not getting promoted or retained simply because they're more friendly with people at the top, but because they're broadly respected, cooperative, and have some adequate level of competency.
The anti-social 10x developer who sits in the corner of the office grunting at people with his headphones on might spit out a lot of code, but does so while causing friction and problems within the wider team. They might think highly of themselves, but they fail to see how a company full of these people cannot operate efficiently.
Doing "real work" + making effort to be liked and cooperative with those around you is the right strategy. Over indexing on just being like or just doing real work isn't going to get you very far.
You said, "they don't like me" and if that's true I do think you should try harder to be liked. You can still raise objections to things and have your own input, but learning how to do that in a way that doesn't irritate people or derail the team is an important skill to have.
I empathise though because I struggle with this myself – I'm autistic so I find it hard to be likeable and communicate with nuance. I have lost jobs and promotions because of my inability to play well in teams in the past. Even today it's hard, but it's better now I at least try my best.
I think, you‘re mixing up normal group dynamics with toxic office politics. When someone very visibly starts licking a* of the superiors. And the superiors very visible promote that individual. Everyone else is somehow confused and alienated afterwards. Not my first toxic environment.
I funded my studies working as intern at the university, it was sometimes rough, but very competitive work environment. There were some intrigues regarding lab funding and permanent positions, but it was fine after all. What I found later working for smaller and bigger companies is too bizarre. The amount of people who are ready to slit colleague’s throats for 200€ pre-tax monthly salary increase is shocking high.
Working in a team is nice unless the team is not functional. One can bake much bigger cake in a team. But… it appears there are too many people who will take team’s result and present as their own. Or just ignore their work packages. Or managers not resistant to a* licking.
I have good relationship with colleagues on my level and with my direct manager. Production guys come to me with technical problems, because they’re afraid of other hardware developer. The thing is that it’s ok to be not liked by everybody. I don’t like uneducated general manager assigned to this company by the new owner. I don’t like the bozo explosion happening here. The production guys don’t like other hardware developer. My manager does not like interim HR manager. But it’s fine as long as it does not lead to psycho relationships and toxic behavior.
The anti-social 10x developer is more often than not the anti-social 1x developer that makes everyone else move at 0.1x or worse. Not that I directly blame them for it - there is far too much focus on the individual here. It's not so common they are bad people, but more that their own management doesn't provide them with the incentives to behave any other way. It's all about incentives. If the incentives are there, the parties involved will inevitably find a way to compromise in a way that works for them, but if the incentives are fundamentally misaligned, there is no way this gets resolved. The only option is to run.
Toxic people and environments are not uncommon. It sounds like you’ve not experienced that too much, which is good. But there are sociopaths, liars, ladder climbers, manipulators, narcissists, and lots of other imperfect people who care more about their own title and compensation than the product or coworker harmony. As an autistic person, you might invest in learning how to spot such people to protect yourself.
You can never be sure of that (your conclusion). I had consistently disagreed with one of my managers, and ended up with the most positive performance review ever from them (I expected the opposite). It did help that I delivered on what I insisted on, of course :)