If a malicious actor found a gay person in such a job, they could easily extort them with the threat of getting them fired! So obviously you had to fire gay people, lest they get extorted by someone threatening to expose them and thus get them fired.