But someone who is a 10x programmer or has published a lot of great results in mathematics? That pit of envy in my stomach will appear.
It gets worse when you compare yourself to someone who is better in both the things you care about AND the things you don't care about. This is because we placate ourselves with the fact that others are better at what we care about by saying, "at least I am better at them in this area, even if I don't care about it too much."
The way Christianity deals with this problem is one of the most appealing things about it for me. "From dust you came to dust you will return." Instead of focusing on your selfish ambition and self-glory, focus on the beauty of what is at play, ultimately seeing it as rays of light coming from God's glory.