The Lord, when he Judged a city, it was usually because the whole city was corrupt and living in sin 24/7- He wouldn’t just a city if they had righteous remnant of believers in it- and the city woudl have to be thoroughly corrupt and vile with no hope of redemption because their hearts were hardened- God was long suffering, not wishing ny to perish, but there comes a point where He gives them what they deserve-
Sodom and Gomorrah would have been saved if 10 righteous men could have been found...
Not what they “deserve”, rather what was necessary to keep clear the generational path for the coming of the promised Messiah.
Read the relevant passages again and it becomes clear that as Sodom and Gomorrah were threatening Lot, it followed the threat would extend to Abraham.