None of the men I know are rapists either. I am generally only friends with nice people. None of the transwomen I know have given me a moments concern that they might be any more likely to be a rapist than any of the men I know. That doesn't stop them from being male.
You are friends with nice people. That group of nice people includes various different genders and identities, and that's lovely.
Law is not based on the assumption that everyone is nice. Most people are nice. Some people are bad.
The most vulnerable are protected when all the nice people behave in ways that make it very very difficult for the actions of bad people to go unnoticed and unchallenged. Eg in safeguarding, people in positions of authority and influence are very careful not to be in a totally unobserved 1:1 with someone vulnerable - office doors are left open, another adult is within earshot, buildings are designed with windows in the doors - and that's what is normalised so that someone with bad intentions has to be seen and noticed to break those conventions in order to get into a private 1:1 situation with their victim. Every single good, kind and non abusive teacher, priest or other person who follows good safeguarding practices is helping to reduce the tragedies where safeguarding fails and someone is abused.
Similarly every single good, kind and honourable transwoman who stays out of all-female spaces is helping to keep those spaces safe by making it so rare that a male person breaches that convention that everyone notices and is on high alert if it ever happens. And every single transwoman who uses female spaces is helping to erode the idea that single sex spaces can ever exist, and makes incidents like this more likely even if they never hurt a woman directly themself.