The simple explanation is that we simply don't fully understand how sexual preferences form. But that should be a moot point on this because why should people care? You're a human, I'm a human ergo we have the same rights. End of story. I know that is not the world we live in sadly.
The underlying issue here is a matter of unity. People want to be with people like themselves, and consider sexuality a parameter in this. Obviously we need to change that, but it shouldn't matter one iota why some people are gay.
I wish it were that simple, but unfortunately pedophilia still exists even though it fits all your criteria. Clearly some people adopt sexual behaviours even if it could lead them to a terrible outcome. Actually, some might do it specifically for that reason and the thrill of it.
You could make the same comment about religion, drugs, literature, politics etc... It's not rare for humans to adopt behaviors that put them at risk even if there are no obvious benefits. People routinely endanger themselves while doing kinky things. There probably are more kinks out there than there are genes in the human genome. There's clearly a large number of factors at play here, only some of them genetic.
Being gay isn't a kink, just as being straight isn't.
Straight people continued relationships despite being outlawed, which is the entire premise of Romeo and Juliet. Would you call Romeo and Juliet's relationship a kink?
Some people are way to powerful to be punished like Leonardo Da Vinci who apparently everyone knew was Homosexual but remained close to power because of his importance (mostly due to skill)
Even being terrorist or mass shooter is condemned by society but doesn't stop the determined ones.
Don't get me wrong, I am not saying being homosexual is like being a terrorist, just comparing the condemned part of the situation which used to be the case before.
(Obviously "fluidity" of sexuality does not preclude "born this way" - it could be that it's written in your genes that your sexuality would/will change throughout your life, similar to many people's libidos and/or hair color.)
Edit: on second thought, it's very possible that it could be random environmental influences (e.g. amount of... I don't know... drums + beech pollen ... the fetus is exposed to in the womb) - that could be pretty much orthogonal with genetics, while still leaving the person with "no choice". It's just that AFAIK most personality traits have a significant genetic component, either actually genetic or epigenetic [1].
[1] https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4739500/