Partly. But another big part is a fear of the mystical “catching the gay.”
To further complicate things, even some gay men idealize sex with men they perceive as “straight.” Though i don’t know many straight men who enthusiastically suck dick.
Some men who are attracted to other men internalize shame and devaluation of the feminine to the point where they loathe themselves and other men they think of as “gay.”
Then then they seek out “straight” men to have furtive sexual encounters with.