Dunno about SF, but the mitigating factor in. LA is that the bathroom is locked, you ask for a key, the key is only for customers. Not every place has a public bathroom but they didn't before either.
Don't know if that's illegal but I doubt anyone cares about mom and pop shops. All the large chains still have open restrooms.