There is no reason that shops and cafés can't make their toilets open to the general public, as long as there isn't a queue of people it's not an issue. A small charge for this wouldn't be unreasonable, especially now.
To be fair, though, there's no reason why you can't make your own toilet at home open to the general public. Toilets cost money to provide, maintain and provide supplies for. Most of the public would soon see this as an entitlement and be outraged at being asked to pay as a non-customer - they'd actually hate you more for providing them with an option than if you'd just said No from the outset.
Loads of people have a good reason for needing it - they have small children, are pregnant, elderly, disabled, have mobility issues, just 'are really desperate' - and any one of them could easily leave it vomit-inducingly filthy. It would be like the situation with prescription charges in England, whereby so many people are exempt (not saying they shouldn't be - I am as well), that only 10% of people actually have to pay (which is very unfair, IMHO).
The real reason for the issue is far too many public toilets being closed, but I don't see why small business owners should be expected to pick up the costs and inconveniences for councils cutting essential services.