Oh, they definitely know. But a lot of them get off on it - they fetishize and enjoy the feeling of "crossing boundaries" and being in places where they clearly don't belong, and the reactions of women to them in the bathroom or any other women's space is what does it for them. Not to mention that a lot of them have straight up turned their hatred for women into a fetish for scaring the shit out of them and seriously get off on how worried women look when they enter a private women's space. I've read a bunch of stuff from troons who go on about how much they love seeing the scared expressions on women's faces when they walk into the bathroom, some who were even really blatant about masturbating in the women's room after scaring women or with the goal of scaring women.
And some of them just have Terminal Male Ego Syndrome and honestly believe they're beautiful stunning "girls" and anyone who doesn't think so is a dirty transphobe, of course. Those ones have literally no attachment to reality.