Back to Japan...
It's a particular sort of attitude that Japanese don't like, rather than "foreigners". They don't like being exotic artifacts neatly packaged and sold to the West.
My friend once said "most people don't see us as a person- they just want help with Japanese, they want things translating for them, they think we're superficially polite and one dimensional" I can completely see what makes her feel like that.
I don't think it's foreigners in itself they take issue with. Here's a video from the other side of the coin.
Other things to be aware of...
When you go to Japan you ARE an outsider and there is nothing any Japanese person can do to change that. Some people talk as if they want to go to Japan and become Japanese overnight and will accept nothing less.
Japanese people think Japanese is a difficult language to learn. So what you might interpret as dismissal or being patronised when you get the inevitable "your Japanese is really good" when you've only said good morning is not that at all. Don't take it personally. The entire Japanese language education industry works off the assumption that it's a hard language. The JLPT N1 (the highest Japanese language qualification you can get) is only equivalent to the sort of standard you'd need to access an undergraduate degree in say a European language. Graduates in Japanese I know can only just pass the N2 (the level below). I have the N1 and only consider myself to have built the foundations.
Don't take children staring at you personally either. It's because you look different and they want to know what you are, no more no less. When I was a child the UK was less diverse than it is now and we had two Yemeni students in our class. I imagine we all stared at them too and the word 'paki' was probably thrown around quite a lot. Children don't usually use those words with the same nuance as an adult and they just need to be corrected. In Japan's case the more foreigners that do go there, the more educated children will be towards things outside Japan.
I'm currently in the process of applying to go and teach in Japan for that exact reason
