It is not as simple as suggesting that when people reach a certain (and low) level of goodness that G-d decides they no longer need to live. We have counter-examples: Rashi tells us that the generation of the Tower of Babel was more wicked than that of the Flood – yet the Flood generation was destroyed (save only Noach’s family), and the Tower generation was allowed to live. Is this some kind of divine caprice?
The most important data point is not the absolute level of sin, but whether or not there is room for improvement, for growth. In the generation of the Flood, the absolute best person who was a product of that society was Noach. The problem was that Noach, righteous as he was, was incapable of proselytizing, of helping to make other people better. In other words, society was in a death spiral. Even its leading lights had absolutely no hope of leaving the world a better place a better place than they found it in.
G-d does not care about our lives for their own sake. He only cares about the choices we make, the potential we have to complete Briyas Haolam. At the point at which it is clear to Hashem that we are beyond the pale, then we have no further reason for existence: hence, the Flood.
The Tower generation, as evil as it was, was not beyond the pale. Terach and Avraham were born from it, and ended up leading the world out of the darkness of paganism and human sacrifice. So while the Tower builders may have been more evil then than they were during the Flood generation, there was still the possibility for improvement.
The next act of mass destruction at the hand of G-d was Sodom and Gomorah. These cities were famous for being hostile to guests – they were the very antithesis of Avrahamic kindness. There are no coincidences in the Torah; Sdom is destroyed immediately after the Torah describes in great detail how beautifully Avraham took care of his guests. It could be argued that Avraham’s acts raised the bar for all of humankind, and Sdom no longer made the minimum cut. This explains why Avraham pleaded with Hashem to save the city; he was aware at some level that if he, Avraham, was not so wonderful to guests, then the people of Sdom would not have been destroyed. In other words, Avraham had some indirect responsibility for the death of entire cities. When Avraham was good, the wickedness of others stood out in stark contrast.
The responsibility is only indirect, however. The cities of Sdom and Gomorrah were not just hostile to guests as a matter of custom. They had institutionalized the practise, making it illegal for anyone to care for a stranger. While this institutionalization may have been a reaction to Avraham, it also clearly shows that the society of Sdom had dug in its heels. Sdom was not destroyed just because it was wicked. It was destroyed because it had signaled its complete and utter unwillingness to even consider spiritual growth. In other words, once Sdom locked its wickedness into law, then by the divine logic applied at both Babel and at the Flood (and years later with Nineveh), there was no longer any reason for the city to continue to exist. It was incapable of producing goodness, now or in the future.
So when Avraham pleads for there to be at least ten righteous men in the city, he is making a very specific argument: that there is a critical number of people necessary to exert a positive influence from within a society, capable of bringing even the most evil society back into the light.
But how is this logically consistent? G-d did not destroy the world when Avraham was only one righteous man. If Sdom needed ten men, then how was Avraham, alone, ever enough?
I’d suggest that these are separate case. When a society absolutely refuses to improve itself, as Sdom did, then it takes ten people to have a chance to redeem it. But Avraham was not born into such a world. His world was one in which there was plenty of evil, but it was not eternally preserved in the laws of societies. In an organized evil society, it takes ten men for there to be any hope of reform. But in a world where most people just do what is right in their own eyes, then a single holy couple can be (and clearly were) a light unto the nations.