“...thinking about the relatively modern era”
Yes, and that makes for a very shallow understanding.
The first hunter-gatherer and farming states had and enforced marriages.
A well-known example of one reason they had to do so is in the story of David and Bathsheba.
Exactly, Apaches, Ancient Greece, New Guinea head hunters, everyone had/has marriage law.