There's a third option, between heredity and learned behavior, and I think it is the correct one, that of it being caused by congenital conditions.
In some cases, yes. And that might be enough to justify a public policy of acceptance. I support such a policy, except for the public spending implications of recognizing gay marriage. In a perfect world, the government would be out of the marriage business altogether, and marriage would be a religious ceremony with no public fiscal implications. Since the world isn't perfect, I guess it's fair that gays be allowed to marry. I am under no delusions that most of them are "born that way."
Based on what is now known (subject to change as we find more and more genetic markers for things), homosexuality starts as a fixation, then graduates to a compulsion, then an addiction (or "lifestyle" if you prefer). People become fixated based on stimuli available to them in the external environment. If this is true, then as the number of stimuli promoting the gay lifestyle in the external environment increases, so too would the rate of homosexuality, and that is exactly what we have seen.
In the case of transgenders, it is always a case of graduating from fixation to compulsion to addiction. The number of positive stimuli promoting transgenders in the external environment has increased tremendously in the past 10 years or so, and we have seen a huge increase in the number of transgenders. In fact, Gen Z is obsessed with the idea of "gender fluidity."