Because self-identified 'women' can't rape, because a man who is willing to be identified as a woman is not really perceived as a stereotypical (aka real) man according to the patriarchy.
But non trans males can rape, because they are tick box acceptable (real) men. Therefore the prisoner was in danger.
Maybe that's the dumb thinking. The patriarchy does not consider men identifying as women to be a man according to their definition. So by that measure, they cannot be dangerous to women. So they can go on the women's prison quite safely. However the woman cannot go into the 'real' men's prison.
The patriarchy has a narrow scope of what constitutes masculinity, which is half the problem.