How did these animals survive as a species for millions of years with this flip-over bug in their genes? Why hasn't evolution solved it, for example, by eliminating flip-prone individuals from the gene pool and giving better survival chances to those who can right themselves?

> How did these animals survive as a species for millions of years with this flip-over bug in their genes?

Whether or not they can right themselves depends upon the terrain. Falling over can be a fatal experience for humans too.

> Why hasn't evolution solved it, for example, by eliminating flip-prone individuals from the gene pool and giving better survival chances to those who can right themselves?

Evolution is all about trade-offs. Being big makes it hard to right yourself, but it also makes you much harder to flip. It probably also probably makes you much hotter to potential mates.

You're assuming natural selection selects for not flipping over, when in reality, it selects for the winner of the shell flipping contest as presumably without intervention, the flipped tortoise does not breed, while the winning tortoise does (or at least still has the opportunity to)

They reproduce before it happens and the brood sizes are too numerous to select against that

Evolution can’t compete with Joe Hollins