I knew an Airforce guy stationed on Japan, he said the Japanese straight up made whole villages and districts off limits to foreigners. Not just to soldiers. He said it's to dissuade land flight of women.
Excuse my French, but bullshit. This is probably some game-of-telephone story of some bars near American military bases plastering "Japanese Only" signs on their doors so they don't have to deal with drunk GIs.
As a rule of thumb, the only places in Japan that do not welcome foreigners by default are in the sex industry.