And the other part of that fucked up story is that the "moral" (and I use that word very loosely) is supposed to be about being kind to strangers in your Country.
What's arguably even more fucked up is that the basic assumption the story relies on is that the audience is intended to see Lot's choice not as a betrayal towards his daughters, but as a personal sacrifice in giving up his property. This was considered to be so obvious to the people of its time that it goes unstated.
Nah, it's guest rites. Or guest rights, depending on your perspective
It's a huge thing in all ancient cultures and probably all religions. Not even just ancient cultures, the US had similar things in the frontier days.
People used to walk across continents - humans can't just hike for 6 months, we're not built for that - we have to take breaks and build up a bit before we keep moving, it takes time to keep yourself supplied.
Humans leap frog, it's how we spread worldwide. We have guest rites - sets of expectations for guests and hosts, and violating them is a major taboo. Even in our media, it still fills us with instinctive revulsion
Is this example ridiculous and morally dubious even in it's own context? Absolutely.
But it's not just about shielding a foreigner, it's about the moral imperative to follow through once you've offered someone shelter