We can’t always have everything but we can seek out some of it. If you aren’t being paid that well, then what the hell, you’ll find the same money or more somewhere else doing something that doesn’t make you feel like garbage.
Someone else made a legitimate point. Say you’re actually not that strong of a developer. That’s fine - but you’re probably relatively awesome in some settings. Your work doesn’t need to define you, and if competing your life away to feel like a loser isn’t emotionally or financially rewarding, the public sector has plenty of less competitive roles you might do well in. There’s security, regular hours, good enough money, etc. Being the best at writing code is worth nothing if you hate your life while you do it, so your actually skill level isn’t all that important.
Above all, don’t measure yourself by how well you perform at work. Make a life for yourself outside of work, and work to service that life. Find people who care about you and don’t think for a moment about how well you do at your work. Distance yourself as much as possible from those thoughts. Tech can be insular and competitive, and you can wind up with weird ideas about things. Ultimately, none of it matters.