Well, I think you reading other people's actions perhaps wrongly or ethnocentrically and from my long experience in Japan and in the field, you maybe suffering culture shock. Totally out there but I'd put your stay time in Japan at 1-3 years, maybe in the middle. But maybe I am the one misreading. I have no more comment on this except, don't judge too quickly in a context you are not used to.
I agree with you that it's important to not overreact or to reflect upon your own actions too. Take a moment to consider the situation, and your part in it. Are you drunk or have been drinking? How will your reaction be viewed by the public? What is the best way to handle the situation? Is it worth getting into an argument? Think, before you leap. Choose your battles wisely.
However, with that typed, insults and racism do exist. It's equally foolish to pretend they don't and it can be bad to do nothing, because bullies and racists (evil in general), can be encouraged when nobody does anything to stop it or confront it.
I wonder now if this could be why my boss always harassed me at work until firing me. Retrospectively, the copy machine puts you in a position where your back must always face him. I was using the copy machine more than others at the time and the attacks against me while using it grew and grew over weeks. Although, I'm the nicest guy to almost anyone and have a very high tolerance for bullshit compared other foreigners I've seen in Asia, I also believe that could have been part of my mistake as well.
Yes, it could be. I've seen Japanese do this to various foreigners repeatedly. In Japanese culture, it's a well known tactic and trick.
Some counter-measures are:
1) Skillfully and intelligently call out the behavior.
You don't have to label it as racist, but question why the Japanese person is doing this particular behavior. Look them in the EYES, while you are talking about it. Often, that particular Japanese person will understand that you KNOW what they are doing and will CONFRONT them each time they will try it again.
Often the Japanese person will slyly try to deny what they are obviously doing. However, the key is they understand they will get called on it, so some will give up trying it.
2) See if you can get other Japanese on your side.
Not all Japanese agree with bullying, racism, etc... Some are international minded, moral, or very fair. You might be surprised, but when you call out bad behavior or treatment, there can be Japanese that will understand it as being such and they don't like it either. They will talk to the other Japanese person and tell them or suggest they stop it.
3) Always Have Your Resume Ready & Be Looking For Other Jobs
As a foreigner (even for Japanese now too), don't trust that a company won't try to cut your position after a few years, hire a person to replace you, or promote a subordinate over you. Many foreigners in Japan have been blind-sided by this.
This is a
game played by many companies now, not just in Japan, where they are constantly growing and cutting. You never know when a company is secretly on the "down cycle" and cutting personnel, and will look for any excuse.
Private/secret meeting of upper management: "Tanaka-san, we need to cut 5 people this year to save costs. Do you have anybody in mind?" Tanaka-san looks over at that foreign guy's desk. "Hmmmm, I think I might know a few people."