Well, it’s not such a big problem as it is in, say, health care.
It’s in the train co’s interest to have working toilets (not too many, because they displace seats but some) and have them reliable and easy to maintain (else costs go up, maybe even they need more per train). This is why they care about a denial of service attack (btw an electronic one can tell the conductor when the toilet is locked for a grossly atypical duration).
So to that degree the interest of the carrier and the passenger are aligned. This applies to most of the carriage decisions (robust seating, working doors and brakes, and so on).