This defense mechanism has nothing to do with being gay in particular, it has to do with lacking self-confidence at large and happens to hetero males often enough that I've known a few. And no, they weren't all closet gays lol.
Now if you want to say his lack of self-confidence has to do with being gay, that may be possible, however I really doubt your friend is being bullied into it. Gays aren't exactly stoned in the streets, or even mocked very much anymore since everything is so locked with political correctness. Hell when I was a kid I was mocked over many things, some of them hurtful some of them less, but kids bite man, that's just part of how you grow up, and gays don't have it any worse than the fat and slobby kids in school.
I'd say your friend is just shy and/or hasn't emotionally matured very much yet. Sexual orientation has little to do with it tbh.