Infact how do the Avengers ever defeat Thanos in the comics when he has the Infinity Gauntlet. Shouldn't he be absolutely omnipotent at that point.
Thing is, they never actually
defeat Thanos when he has the Infinity Gauntlet. What happens is that the ultimate power Thanos so desperately seeks is never what he expects it to be, whether such power comes from the Infinity Gems, from a Cosmic Cube or whatever else. Let's walk through his mindset for a second:
In Thanos's quest to gain Death's love, he goes far beyond what any other mortal has ever done, becoming the supreme being of the universe, an undisputed and omnipotent ruler. What if, even after that, Death refuses to show you any affection? What happens when you could bend reality to your will and yet you're unable to make her willingly appreciate your efforts or your person? Sure, you could force her to do it, but would that be the same?
Let's take a step further, go beyond the relationship with Death. After you're omnipotent, what happens next? There can't possibly be any other goals after that. Which leads to: is power a means or an end? If it's a means, then it's useless, because you were still unable to achieve your primary objective. If it's a goal, that's the end of the story: what else will your life be for?
What's the point in being omnipotent in a world that has nothing else to offer you?
Part of what makes Thanos such a compelling villain is that his plots are never just about the hero defeating the villain. Put most other antagonists in his position and you'd get stories about an invincible villain that is eventually defeated through persistence and cleverness of the heroes... not Thanos. With Thanos, he just sabotages his own plan, subconsciously, by failing to go all the way or by exposing fatal opportunities to his rivals. Why? Maybe because all his effort was for nothing. Maybe because he believes himself unworthy of all that power. Maybe because he fears there is nothing else. Or maybe he fears the realization of being wrong and unsuccessful from the beggining.
The real answer is "all of the above". I remember reading The Thanos Quest for the first time and being speechless at how brilliant the conclusion was, and even moreso after seeing Thanos slowly breaking down during Infinity Gauntlet. These questions are part of the introspection that makes a great villain. Who knew becoming a god could be so bleak?