You're presenting a legitimate point about freedom of association—people can't be forced to become friends with anyone. However, that doesn't mean discrimination should be dismissed as irrelevant.
If someone avoids a classmate solely because of their race, it's reasonable to question whether prejudice is involved. A person's right to choose who they interact with and a person's right to be treated fairly can both exist at the same time.
Japan is a sovereign country with its own culture and identity, but that doesn't mean every instance of social exclusion should automatically be accepted as normal or justified. It's possible to respect a country's traditions while also discussing how minorities and foreigners are treated within it.
The issue isn't whether Japanese people owe anyone friendship. The question is whether race is influencing how people are treated, and that's a discussion worth having without assuming either side is automatically right.