I think you're making a big leap saying "let them deal with the frustrations of relationships". Nowhere in OP's post does he mention disliking people. In fact he seems proud of the fact that people come to him when they have questions. You need more than pure technical acumen for people to feel comfortable coming to you.
Situations like these are complicated, and I'm not sure there's enough information to make a judgement one way or the other. I do think taking the "high road" here is not always the best course of action. If you're more interested in the success of your team or your product, you will remain ripe for being used by those more interested in their personal success. It's a toxic circle that's hard to escape once you find yourself in it.
My advice would be to heed the red flag and look for work elsewhere. If you are being leaned on as heavily as you feel, then it will likely become apparent once you move on to greener pastures.
As @eriktate said, you either make some noise because you care, or you realize that the people above this person don't understand what makes great technical leadership actually great, and you leave.
The more people in management that care about building well engineered products and that treat humans like humans and not resources the better off we are as a community.
It's quite possible the other person did a lot of the "people" work that enabled the code to be written and distributed. In that case, it's a "we", not an "I", and focusing entirely on "I wrote the code", ignoring how it fit into the organization, is dismissing someone else's well-deserved credit.
I have seen the case you're wary of: a technical, but poorly communicating, employee that resents the success of a well-meaning, less technical but better communicating coworker.
I have seen good people like that, and I have seen snakes that pull the "we/I" as in the OP's story.
Generally, I don't see a lot of these "snakes" out in the real world, but I see a tremendous amount of misunderstandings, resentment, and righteous indignation. As I told the OP elsewhere, we're all the hero of our own stories, and everyone we disagree with is a villain. But ask the villain, and they think they're the hero. It's human nature. We don't want to admit that we might be wrong, that the people we disagree with might be right (or at least, the disagreement is not founded in malice).
So when I see situations like this, I rarely see snakes. I see misunderstandings that can be addressed with better communication and a good dose of humility.
I have nothing to complain about. I've done very well career wise, and have no reason to beef with any of these people. But at the same time, I've concretely seen individuals lie outright, blackmail, threaten, insult, and bully their way to success. That you say you rarely see this makes me raise an eyebrow. I've gone through the "maybe I'm just seeing evil where there isn't any" thought process many times, but after watching multiple instances of negative actors take advantage of others while I was a disinterested third party, I can't but have conviction. People will abuse others when it serves them and they think they can get away with it, and in situations where power dynamics, visibility and relationships (so soft, highly non-fungible elements) drive your career, someone in power can get away with a LOT, even via only subtlety misaligning incentives.
Let me be clear, this is not some dominating majority of the population, and one should not start seeing enemies around every corner, but I've seen enough that instructing a junior engineer to watch out for those who would seek to take advantage of them seems very pragmatic to my eyes.
People who let bitterness rule their lives are far, far more common than actual snakes.
Assuming my observations are correct (I may be wrong, I'm often wrong), then what is the pragmatic advice to give? "Be wary of snakes!", or "Be wary of your own human desire to be the hero of your own story and make everyone you disagree with the villain"?
To me, this is a variant on the Pragmatic Programmers' advice that "SELECT isn't broken".
I think perhaps the issue here is that I'm coming at the discussion from over-correcting the opposite direction; I was raised with very much a "people are All Good(TM)" outlook, regularly being fed the "Things get better after highschool/people grow up" line as a child. I've found that these both gave me ineffective priors for navigating adult life, largely due to that if you assume people are acting with your best interests at heart, you may be less inclined to look out for your own best interests yourself, or at the very least how other people may be compromising it, consciously or not.
Framing it in terms of incentives also has the wonderful side effect of circumventing a lot of they "are they malicious or just self-serving" question since it hops right to "how do you fit your success into whatever equation everyone else is trying to route into"; my inquiry of whether they were TRULY malicious is usually made post-factum (or given sufficient evidence)
As a final statement (and to couch my own incompetence with tone over the internet, please don't let any of this come across as a You're Wrong!), I'm not sure I'd agree with your statement that people with bitterness outnumber those who would manipulate others, at least in my work context. In the lense of my "incentives" stance, both are continuums of behavior, but the bitterness continuum is counter-productive to career advancement while the "manipulating incentives" continuum is productive, so I'd logically expect to see more of the latter. (I guess the real crux here is "when does it become malicious," but that's a whole separate discussion)
This dovetails into your last paragraph, by way of saying that the fact that paranoid behavior is counterproductive is in no way inhibiting paranoid behavior. People believe it works. What people believe is far, far more important to them than what actually is. We engage in counterproductive, even self-destructive behavior all the time. And not just the "incompetent" people, but everyone I know. We are all stupid. (fwiw, I do not consider "smart" and "stupid" to be opposites, but rather different qualities that happily coexist. Just because you're smart doesn't mean you aren't also stupid.)
This is also aggravated by the human distrust of those who are different. How many employees think their managers are ignorant fools at best, and actively malicious at worst? A majority, probably. How many of those people really have a good understanding of their manager's job, and the pressures and conflicts the manager deals with? Not many, I'd wager. This is the root of racism, nationalism, and other forms of tribalism, if you think about it. Those feelings are irrational, but they're common as dirt.
This view of humans as stupid rather than malicious was reinforced for me recently, when I read Factfulness, by Hans Rosling (which you should definitely read!). Rosling, a doctor/professor/world health expert, tested thousands of people with basic multiple-choice three-options questions regarding well-documented facts on the subjects of poverty, global health, and the link. What he found was that every audience, no matter how smart, well-educated, caring, or involved in the field, actually performed worse than random chance. Start on his questions, without reading his book first, and you'll find yourself doing worse than if you'd just pulled letters out of a hat. Don't feel bad, the same is true of UN leaders, CEOs, med students, etc. Rosling went on to identify ten different thought patterns that lead us to misunderstand the world, even the most basic facts about it.
Read it, and then look around the corporate workplace, seeing it through Rosling's eyes. You'll see very few snakes and a tremendous number of idiots.
I'm pretty sure this was simply because he thought it couldn't be done, and I just put the niggling thought in his mind so he tried and was successful.
Weirdly enough he was the introvert and I less so, and I got the promotion. No hard feelings on either end, as far as I know. We all have our quirks.
You don't seem to understand why the term is "snake" in the first place. Of course you don't see them. They're hiding in the grass, and you're not going to notice them until you step on one. That doesn't mean the people around you aren't getting bit.
I'm not saying it's great, but it also sounds like the OP needs to be more proactive about speaking roles in meetings when it comes to value of their practices, why things were done, etc. Now, would I work for a person if I hated them? Nope. Would probably be out of there.
In terms of "How can you!?", this stuff happens all the time all over the place and people work together. I think you can work through it with colleagues - it's not easy, but it's important if you think the mission / company are worthwhile. Otherwise, you're just going to dig deeper "into the box" on the credit thing and it won't be a good reflection on your work.
That's not true as I always hangout with the people in different teams, and, we get along pretty well. I just don't do kiss-ass to my boss and I don't take advantage out of situations.
> Find ways to work together
We worked together for two years on daily basis. And I overcome a lot of bad behaviours but I can't stand to report to him
I've been in your shoes - a peer got promoted to be my manager when our old manager retired. We were okay as peers, but very bad in a hierarchy, and I eventually got fired. I should have just quit instead.
Still, though, I think you're letting resentment blind you. It's easy to be the hero of your own story, and for anyone you're in conflict with to be the villain, but that doesn't mean it's right. We're all unreliable narrators.
Try this exercise. Repeat after me... "I may be wrong. I am often wrong." This is my mantra. Recognize your own fallibility. Try looking at it from the perspective of "What if I'm wrong?" It solves a lot of problems (or leads to the correct solutions). And the more you do it, the easier it is. Consider my earlier point, that what he did isn't incompetence - not if his goal was to get out of technical and into management. And since he's apparently good at those people things, he might well be recognizing where his talents are, doing the right thing for himself and the organization.
Consider also a telling bit of evidence in your response to me - "we worked together for two years on a daily basis". If that's true, is it also true that you did all the work and he unfairly claimed credit? What was he doing, if he wasn't writing code? Is "kiss-ass" a fair assessment, or an resentful interpretation of his useful work? Try to stop being angry long enough to consider that.
However, if this:
> I can't stand to report to him
remains true... the only solution in the end that will leave you with day-to-day satisfaction is to leave the situation. It sounds like you are aware of this.
Life is not always fair but in general it is consistent.
It seems to me like people skills are a weak spot for you. That's not unusual in our industry. But leading and managing people, sorting out the relationships to make large project work, that work is just as essential as technical skills are. Nothing big ever got built by a bunch of grumpy, resentful introverts.
Rather than hating his "incompetence", try to recognize him (and others like him) as valuable allies. Find ways to work together, to let them deal with the frustrations of relationships, and let you focus on the technology. Create a mutually beneficial partnership. If you can't learn to do that, to trust the "people persons", you're going to find yourself in this situation over and over again.