In the brainspace of practically everyone raised in Japan, there are two kinds of people in the world, nihonjins and gaijins. Unsurprisingly, this works the same way as any dualism -- the inside is defined wholly in terms of not being the outside, the latter being the foundation of the human notions of bad, dirty, undesirable. Inside-outside dynamics seem to be near-unavoidable among the humans. In any given place, whichever inside has power enacts its inside-outside dynamic, making its outside suffer. Gaijin means "outside person." Exclusionary terms are rarely so straightforward. A skit:
orange A: We are so ridiculously orange!
orange B: This is clearly true, but I'm only agreeing because there's a not-orange right over there. Really brings the orange out of us, you know? If it weren't right there, I'd be analyzing small differences among us oranges and blowing them way the hell up.
apple (speaking fluent orange): Hey, do you fruits know how to get to the nearest compost heap. I'm getting on in days and...
orange A (whispering to orange B): Do you speak non-orange?
orange B (whispering back): No! What are we gonna do?!
orange A (addressing apple in the language "banana," assumed to be spoken by all non-oranges): Banana, no!
apple (speaking orange): You mean you don't speak banana?
orange B (speaking banana): Sorry. I am envy stem.
apple: (walks away, shaking head)
orange A: Did it say it was going to compost? Only oranges compost, right?
orange B: I have no idea what it said! I don't speak banana!
orange A: Whoa, do you see that orange and non-orange over there?
orange B (pointing to an orange, lemon, and orange-lemon hybrid): Yes, and it looks like they have a "half" baby. Halfs are interesting!
orange A: Fascinating, even, but half is not the right word exactly.
orange B: Why's that?
orange A: Well, of course, since it's 50% orange and 50% non-orange, that makes it 100% non-orange. Unless we have some use for it. Then we get the good half.
Differences between fruits have a genetic basis, so the real version, where nihonjins use genetically baseless racial categories, is even more absurd. In other words, change the mother category "fruit" to something far more genetically homogenous like tangerines. Either way, the nihonjin/gaijin split is primary, everything else comes after, taking place within that dualism, which is useless for coming up with a coherent perspective but quite useful for insiders.