Who knows what was done in prehistory, during ages or in cultures where resources were SO scarce that only ones own children were provided for?
I think societies worked that out case by case. I remember reading that some tribes regarded the widow of your brother as your own wife and HIS children would be YOUR responsibility as well as your own.
Even today in the Orthodox faith, godparents represent something more than an honorific status. I was and is STILL done with the expectation that, as in older times, godparents provide for the child in case parents are lost.
Whether people simply listened to scripture, or whether they had worked out that this was best, having codified it with rules for marriage made sense for a healthier population.