Under the law, only certain financial and legal rights can be contracted. There are a number of preferences in the law that are only conveyed via marriage.
One example: the spousal exception for estate taxes. You can bequeath your spouse your entire part of the estate, with no tax consequences. You can't do that via contract.
Good point. The government shouldn’t be in the business of deciding who does and doesn’t have to pay a death tax.