The safety of any group should not be at the expense of another.
Of course trans kids need safe spaces too BUT the situation in schools between male and female pupils is not such that mixing in unsupervised areas is a good idea.
I left teaching 10 years ago and even back then I had to step in on many occasions when boys were putting pressure on girls for photos & sexual favours and the way they were treated when they refused was appalling, never mind what they went through if they did! The rise of free porn, especially on phones, has massively affected teen attitudes to sex and what is acceptable.
There are big issues between pupils separate to the trans issue, but it IS the trans issue that is now putting girls into vulnerable spaces with boys and it's only going to get worse.
Schools need mixed AND individual toilets. It's the only common sense way to keep everyone safe.