Sure you can. Just treat everyone the same. Each person is an individual. All interactions between people can be contracted if they want legal standing.
Why MUST the gov’t be involved in marriage?
What do you mean by “contracted?”
Such a term implies an obligation - a LEGAL obligation - to perform.
What if one party just wants to dishonor a contract? Tough sh*t for the other party? OF COURSE, someone must ENFORCE the terms of the contract. Someone with teeth. And these are the courts.
And courts are ORGANS OF THE STATE. You can’t get around that.