Why? If you're already eating there, why should you pay to use the toilet? And if you're not eating there, then why are you there to use the toilet? Just use a public one. If there aren't sufficient public toilets, that sounds like a failure of the municipal government. Any good city should have lots of public toilets outside, in train stations, or in large shared buildings.
Also, my experience in Germany at a mall food court is that they DO charge you to use the toilet there, even though I was eating there.
If there even are public toilets, if they are open, if they are in a state to be used (and not just an uncleaned mess), if they are free... plenty of reasons to go to a restaurant to use their toilet.
Which might be also paid (assuming they even exist)
It's not exactly common. In Belgium, the behavior is like when they thought it's really good or if people worked on a restaurant before.
But nobody expects that anyone would tip.
Last time I went to Hungary it was added to the bill though
Ps. A bottle of water is free in France and some other places.
Giving 50 cent for a restaurant when only using the bathroom is just a sign of good behavior in my view. Depends if I'm hurried, but I'll usually buy a glass of water. Then I'm a customer ;)