Did the idea of marriage appear as a result of a need of a social order before religion and then religion came along and formalised, ritualised and regulate it?
was the system of marriage given by religion alone?
Is this system likely to survive the pressures of time? Will science completely upset it by inventing a system of asexual reproduction for humans and a made to order progeny?
But my impression is that pair-bonding, however it would be treated by the state or the community, does have substantial value, and will persist indefinitely as the preferred arrangement in future human history.
It would be good if your optimism comes to be true, but the opposing pressures are certainly building up and doubts are emerging. Future is going to see fast and unpredictable changes.