It has existed for a lot longer than any of the major religions in the world.

Various religions have simply co-opted the idea and now pass it off as their own.

Even if it was an invention of, say, Christianity, you can still be a Christian and gay in exactly the same way as you can be Christian and wear mixed-fabric clothes and grow more than one type of crop in your allotment.

The fact that you do not believe in every passage in your bible, does not mean you cannot be a follower of that religion.

Hence, if you are gay and a Christian, marriage is probably going to be quite important to you.