In decades past, being homosexual was considered a risk factor for intelligence agents. An adversary who knew they were gay could threaten exposure, thereby gaining a lever to potentially turn the agent. So they tried very hard to keep gays out of the intelligence services.
I don't know if the US still does this. I'd be a bit surprised. I wouldn't be surprised if Russia still did, though.
I expect the US still does do this, but only for gay people in the closet since an openly gay person is immune to that sort of blackmail. Same goes for infidelity etc.
Part of the reason they are slow-walking Trump's pronouncements on trans people in the military, is that after getting rid of 'don't ask don't tell', the military will have wanted to know about people's sexual preferences, especially in key roles, so as to guard against cases of blackmail.
I guarantee that they will have key people who have told them all their kinks, that they are really trying hard not to get rid of.
I don't know if the US still does this. I'd be a bit surprised. I wouldn't be surprised if Russia still did, though.