I can relate to this on a somewhat personal level. It hasn't happened to me directly but it has happened to people I know closely and here's why.
This man I know (who is too complicated to explain completely) was married for 23 years to a woman. The people who knew and worked with him knew a few things about this man: he was either bisexual or gay and did... I think BDSM? Not sure. These people were honestly shocked that he even got married. He did these sexual things behind his wife's back. But they kept mum about it and his wife did not know for over twenty years. I still remember when she found out-- I had never seen her cry before and I remember trying to comfort her.
They finally divorced around 2008; it was an odd mix of quiet and messy.
One thing I must admit now that I reflect on it; for as long as I have known these people, their marriage was a complete mess. He could be domineering and abusive and she was easily frustrated and constantly unhappy. It has affected their kids, especially their oldest daughter. Their divorce was for the best. He's still in the closet. I wish he will come out one day.
Now, this man had experienced anti-gay attitudes for a majority of his early life. He was born in a small town outside of St. Louis in the late 1950's and we all know how attitudes towards homosexuals were then. When he was just a little boy in the 60's, his grandfather owned a tavern. They had a piano player that worked in the tavern who was gay and, at one point, he was put into a psychiatric hospital by his family and given shock therapy to "cure him". His grandmother worked until the end of her life in 1969 to get him released.
Here's my theory: this man was aware that he was different at an early age or, when he finally realized what he was as a young man, he looked back on that piano player. Even as attitudes and laws changed towards the LGBTQ community changed and he really shouldn't have been afraid, I can understand, how that fear can remain with someone. This man is Catholic, but he is far from religious (he may just be still claiming Catholic, though, for his parents sake) so I don't think religion had anything to do with it.
Some people, especially older LGBTQ members in and out of the closet, still remember how people looked upon people like them back then; they remember the prostration, the violence, the lack of understanding, their own fear as well as the fear of people around them.
His ex-wife suffered greatly and had to get multiple tests taken for various STIs as well as HIV. It killed her and it destroyed her a little more once she found out her daughters knew about their father.
I blame society for doing this to her and her ex-husband. It makes me so very angry every time I think about it. They preach about wanting to keep the traditional family so much that they don't really give too much of a damn about the health and happiness of the people in it. It makes me sick. They want uniformity and the procreation of new citizens that they can just brainwash and I'm tired of it.
That is an excellent question-- I don't know.