Yes, this happens in Japan especially in the entertainment/hospitality industry (ironically). Small local establishments see themselves as informal clubs. Even an unknown Japanese customer would get the cold shoulder. However, said Japanese would also understand the 'rules' and politely excuse themselves. Bring a foreigner into that scenario and boom. Red flags and paranoia abound.
However, it IS illegal, even though enforcement is spotty at best. Many shops try to explain it away by saying that admitting foreign guests would discomfort their regular customers and cost them business. But frankly, that's too bad. Open to the public means ALL the public. Especially in such an international city as Tokyo, with the Olympics coming this year.
There was a famous (locally) case several years ago of a caucasian man (American by birth but naturalized Japanese citizen) being refused entry into a public bath merely for being foreign looking. His wife could enter, one of his daughters could as she looked more Japanese but the other could not as she resembled her father more. He sued and won a settlement from the business.