For what it is worth a solution could be:
Loos, changing rooms, showers, refuges, hospital wards etc all are single sex with unisex always available to transpeople as a matter of law. Biological men can not use women's facilities and it will be protected by law
In prisons all defendants will be placed depending on their biological function. Transpeople and others at risk can be put on the same wings that are often used now. Segregation wings. Or elements of each prison can offer unisex wings with extra care taken to ensure they are monitored. If you would like to put on this wing you must have a proven medical history of more than x years to support your claim.
Women's prison will only house biological women for safety reasons, this will be enshrined in law.
Sports could introduce a trans sphere, where transpeople can compete against each other with a rainbow flag and positive messaging - a little like the olympics when we added less able bodied, in this case you can enter as you please, this would be especially helpful for gender fluid people. Women's sport would be protected by law to stop men from competing unfairly.
As a country we only treat adults - children suspecting they could be trans will be offered counselling support only. Children should be protected by law from being 'treated' as they are too young to make a major decision about their gender before adulthood at the earliest.
How difficult would it be to put this in place? Any political party could take this on with some degree of courage and clarity and make it fair for everyone. One imagines it is coming, as the issue is now featuring on most interviews with political parties. We need to determine how we are going to manage this, as it is not going away as women are not prepared to sacrifice everything inc their own and their children's safety.