This is the trouble with toilets. On one hand it's unfair to charge for people to go to the loo which is a necessary bodily function.
At the same time the fair consensus seems to be to put the toilets inside the ticket barrier, if there is one. Where there isn't one, it can be a problem. They need to be well monitored and attended to, and at some stations they are not. There may only be a cleaner employed in the morning for example. And where it's busy on the railway station staff are hardly going to be able to clean toilets every hour.
One station I know of was audited by the routine auditor and toilets at this station were checked by station staff, not cleaners (none after 12pm), every hour and they signed a sheet. The auditor marked the cleanliness of the toilets unsatisfactory as there was orange peel all over the floor in one of the cubicles.
How would this even be the fault of the staff. That could happen five minutes after the loos were checked . Many stations lock the toilets at 8 or 9pm but then get criticism from members of the public for not providing toilets.