We've had this discussion before, and you get "heated"..
Likely because I take it personal since I'm in a committed relationship with kids without being married.
Adultery carries a severe penalty in the Bible & Qur'an..
First of all, it doesn't matter what the bible and the quran says when the question is "how does it protect the family". Your answer should consist of an actual argument concerning real-world phenomenon in relation to real relationships with real children and parents and cousins and etc.
Secondly, it also doesn't matter when the subject is marriage. Neither the bible nor the quran "own" marriage. They don't have any exclusive rights to it. Practically every culture ever has marriage. Not just those of abrahamic culture. Abrahamic religion doesn't get to claim a monopoly on the practice.
It makes people think twice before engaging in extramarital activity.
Third... cheating (disloyalty) isn't "worse" when it happens between married couples as opposed to between unmarried couples.
Cheating is always immoral.
Regardless of marriage.
Fourth, if you require a fear of punishment in order to not cheat, then - to ironically use Jesus' words - you have already cheated in your heart. If fear of punishment is the only thing stopping you, then your family has already lost your loyalty and respect.
Naturally, that protects the family. If you can't see how, then..
Even if I would grant you that marriage makes you less likely to cheat for that reason, then it doesn't protect the family. Instead, it only keeps up appearances. But there is no loyalty there. No respect.
You know why I don't cheat?
Because I'm not interested in it. Because I respect my partner. Because I love my partner. Because I could never do that to her.
What protects the family is love and respect.
A piece of paper doesn't change that.
And, once more, if you require the fear of punishment in order to not cheat... Then already the love and respect, and by extension the whole relationship, is tainted.