Marriage was not just for the wealthy and nobles in the Middle Ages, or in the 1800s or in subsaharan Africa, etc.In the Middle Ages, children were an investment. You fed them and clothed them and raised them for just a few years before they started to pay off. As soon as they were physically able to walk and listen to instructions, children began to work, usually on the family farm.
This human capital that a couple could grow themselves made marriage and child-rearing a highly profitable activity. It led to generational wealth, which marriage existed to secure and apportion.
This is no longer true in modern city life. Children are a luxury good, not capital. They don’t produce any wealth for their parents. They simply consume enormous resources until they move out and start their own independent lives.