You might also want to read Equality Act 2010, Schedule 3 [Services and public functions: exceptions]; section 27 [single sex services]
see subsection 6:
The condition is that—
(a) the service is provided for, or is likely to be used by, two or more persons at the same time, and
(b) the circumstances are such that a person of one sex might reasonably object to the presence of a person of the opposite sex.
From the look of it, this can be applied to communal toilets, changing rooms etc in schools.
See also section 28 [Gender reassignment] which means it is not discrimination in terms of gender reassignment to exclude a male transitioner from a female single sex service / space and vice versa.
www.legislation.gov.uk/ukpga/2010/15/schedule/3
[ See also letter from lawyers: forwomen.scot/30/03/2019/tie-letter-legal-response/ ]