There are actually countless ways the Avengers could have defeated Thanos, but in doing so it would have doomed humanity in the long term. In Eternals, it is revealed that the new group of heroes was created by a Celestial, Arishem, an omnipresent cosmic god that continually creates new stars, solar systems, planets and life.
Arishem wanted the Eternals to protect the Earth from the Deviants, other creatures he previously formed that spiralled out of control. In turn, the new team would ensure humanity thrives and multiplies, reaching a point in their evolution that would be ideal for the god’s plans.
Arishem revealed that Earth was actually a giant seed for a new Celestial, and once humanity had reached a sufficient population size, the being would thrust out of the planet, cracking it like an enormous intergalactic egg.