If you travel, and you think that train stations are a snapshot of ethnic diversity in Japan, you're forming the wrong impression. You see more concentrations of foreigners in public transport areas than in real life.
When I first came to Japan, I was, like most Americans, thoroughly entrenched in the idea that people were all the same aside from external appearances. As someone who grew up in a less than ethnically diverse rural town - we had poor white people, very poor white people, and somewhat middle class white people - my feelings about the differences between people were formed wholly based on teachings about what was "right" rather than actual experience. Since I was removed from the environment in the U.S., which is hyper-sensitive to matters of race, I was immersed in a culture which treated me with prejudice and objectified me. Through two plus decades of this, I was indoctrinated into a different pattern of thinking. That thinking is often "we are all very different, down to the blood, bone, and organs," not "we are all the same under our skin". What is more, being constantly objectified has made it easier and easier for me to objectify others. After decades of being an "outsider" (us) among "the Japanese" (them), I have started to treat them as they have treated me - as if their feelings and opinions do not matter and as if we are fundamentally different and always will be. Part of this thinking develops as a defense psychologically when a person is the object of prejudicial behavior, and part of it is living in Rome so long that you start to accept the Roman way of thinking.
We are all racist by nature (likely a genetically shaped survival trait) and it is only socialization that trains us and encourages us to curb said nature. I feel that, for me, the environment in Japan has stoked some very bad thought patterns and behaviors that absolutely did no exist prior to going there. I will not miss how living in a racist country has brought more racist feelings to the forefront in me.