I think you could change the law to allow the currently-conferred-by-marriage rights to be otherwise assignable.
I basically am in favor of religions being able to define "marriage" however they want (and am confident there would be a variant, if not primary variant, of every major religion which supported and another which denounced gay marriage).
The state should do something else, for everyone, with all rights handled through the state's thing.
The quick hack is to just require all new marriages also be civil unions, and not recognize future marriage otherwise. Civil union should get every current private and government benefit of marriage. Strictly religious benefits from private entities could potentially be withdrawn from civil unions (I honestly have no idea what those would be).