Snack bars (the seedier bars you talk about) have always had a policy of no foreigners. In fact, I think it’s just in the standard snacks bar sign template.
* store only for patrons, but welcome if you come with patron.
* anyone welcome but if you're only coming once (tourist etc), please don't (destroy the vibe).
For obvious reasons foreign tourist couldn't get this so many places just put up a "no foreigner" sign. You'll still see local foreigner sometimes hang around those places though
I did this living there from ~2009 - ~2016. Wasn't an issue in my visits afterwards either, at least up until the COVID years.
I will say that when I go back each year (1x/2x per) post COVID, I've seen more of them trying to be firm on it though - presumably due to the tourism influx.