Ah...form. What if the purpose of marriage is for a greedy father to sell his daughter for land or money or power? What if the purpose is to give an enemy a living hostage to secure a tentative peace? What if the purpose of marriage is populate the world with as many Becktemba Juniors possible with as many women possible? The purpose of marriage has no natural order in the world and is most certainly not naturally derived from anything. Marriage is a creation of man and has served a number of purposes throughout history. That has even included giving a gay man or woman shelter from a world that doesn't yet understand them. They marry to appear some definition of "normal" that the world has thrust upon them. And yes, every law discriminates in some form. If it is an unjust form, however, it is an unjust law.
"I would agree with St. Augustine that 'an unjust law is no law at all.'" - MLK 'Letter from a Birmingham Jail'