It's because after the fall of the Edo era the elite deeply felt the need to centralize power and control, and part of the effort was put in nationalist education - ultimately, ultranationalist education even before the end of the 19th century - which came to bite Japan hard on the rear by 1941. Of course, this isn't to say that without such education Japan would even stay unified, as we saw in the IJA-IJN conflicts(surprisingly enough, a continuation of the Satsuma-Choshu conflict before 1868) that drove Japan into unnecessary conflicts.
In historical context, Japan always had a large ego in terms of foreign policy - going so far as to call itself an Empire during the 5th century in a letter to China, although mainly because Korea was sitting inbetween - and it was able to maintain such an attitude because it rarely faced dangers along the border, unlike Korea or China. This is contradictory to the almost prostrating attitude it shows towards Chinese and Korean culture; after the Japanese invasions of Korea a memoirs of a famous Korean politician recollecting the war was highly praised and mass-printed, but the book was barely reprinted in Korea.
The more you know.