Wasn’t it just the sensible thing to do back when the definition of what people today think of as a “sin” was invented? Imagine if safe, reliable, widely-available contraception was around when they were first formulating it, I bet the rules would have been way different.
I guess we could extend the metaphor perpetually - if there was no biological clock or aging at all, the rules might be completely different again.