For what it's worth, I think there's some recent research suggesting that it's better to praise kids for their effort rather than any innate ability or intelligence. This teaches them that success comes from hard work, and not just something you're either born with or without.
Of course, as adults, life isn't that simple. But anecdotally, I've met many people who lead perfectly happy lives doing perfectly normal things. They're liked and respected in their small little circles at work, with friends and family, etc., but otherwise unknown. When they die, they'll be mourned by a few dozen people who knew them well, and then they'll soon be forgotten. But in those few decades, they'll have left a positive impact in their immediate communities and relationships.
What's wrong with that?
There are 8 billion of us now... by any metric, the overwhelming billions of us will be mediocre in most ways.
If you want to seek greatness, you are free to do so, but that isn't the only path towards a meaningful life. You can also build pathways to happiness via relationships, side hobbies, community participation, music, art, travel, etc. Meet new people, try new things, have fun, learn to love more and more.
Your brain and your feeling of "self" isn't some static blob fixed in stone from birth. It changes both physically (as in rewiring) and conceptually (your "mind" and "self) with experience, age, success, failure, etc. The only way to let it grow that way is to try new things and meet new people. You'll start below average at anything at first, but then gradually get better (and perhaps develop more of an interest/liking in it) as you develop aptitude and gain encouragement and respect and mutual liking with others interested in the same things.
There will always be better, smarter, richer engineers than you. It doesn't mean they're automatically happier. Some are, some aren't. It doesn't really matter. They'll soon be dead anyway, like any other famous person of the past. What you're responsible for, and what you have control over, is only your own life over its few short years, and it's up to you what you wanna make of it.
If you're tired of chasing greatness unsuccessfully, there's nothing wrong with trying something else instead. Nobody really cares if you're great. We all know people like INSERT_GREAT_PERSON_HERE exist, but I don't live my life worrying about any of them. It's lonely at the top, as they say.
You can slowly brainwash yourself if you will yourself. Little baby steps can eventually change you into somebody else, hopefully someone happier.
Can you get outside more? Exercise more? Volunteer? Join some meetups? Take some classes? You don't have to be stuck in a vicious cycle of pursuing ever more intense engineering tasks only. There can be more to life than that if you want there to be.
-----
On a more personal note, OP, I think I'm the opposite of you: Math, programming, and most intellectual pursuits always came easy. I never really had to struggle with any of it, and consequently I never really learned to be self-disciplined and to work hard through something consistently. I give up easily, and never accomplished anything of note (and probably never will).
At 40 years old, I'm in debt, can barely afford rent, can't cook worth a damn, aren't exceptional at anything (but am just slightly-below to slightly-above average, i.e. mediocre, at a lot of things!) But you know what? I learned to make peace with it, and that's what ultimately got me through life despite the poor on-paper outcomes.
I'm in a happy & healthy relationship, am well-liked at work and in the community, have a lot of fun side hobbies, etc. People appreciate my little contributions, but nobody will write books about it or anything like that. That's OK. None of those things require exceptional ability or talent, just the acceptance of being "me".
Compared to you, maybe I'm in a less stressful place right now, but long-term, I think you're actually better off! You have a better foundation to build a balanced life off of. It's easier to add fun people and activities to your life than to fix financial problems and learn to work harder and more consistently. You have a strong base that you can "decorate" with fun stuff. I have a weak foundation that I've plastered over with distractions. You got this :)