One of the features, or, depending on your perspective, problems of the koseki (Japan's family registration system) is that it embeds deeply into the legal system a very basic distinction between koseki insider and outsider — those registered in it and those who are not. It thus legitimizes — mandates — certain types of discriminatory treatment.
First, members of Japan's Imperial family are all outsiders, tracked through a different registry known as the kōtōfu. When a princesses marries out of the Imperial family (as they must, there not being any marriageable princes), she becomes a "commoner," a process accomplished by entering her into the koseki system and noting her exit from the rank of royalty in the kōtōfu.
At the other end of the spectrum, there is also a small but significant number of mukosekisha, people who for various reasons never had their birth registered in a koseki. They can have a tenuous legal existence because of their inability to furnish a basic Official Document to prove their birth, identity, marital status and so forth — all of which usually can be verified using a koseki extract.