Japan’s modernization, grappling with democratic and populist forces, and unfortunate collapse into fascism is some fascinating history to read about. “Japan in Crisis: Essays on Taisho Democracy“ is a good starting point.
https://en.wikipedia.org/wiki/Republic_of_Ezo
Yes the Last Samurai had a kernel of truth, but it was not about an American guy, it was a bunch of French officers who deserted to help the Shogun in exchange of him proclaiming a republic. It has all the elements of an epic movie, including a desperate boarding of an ironclad by a samurai-French force that was repelled by a gatling gun: https://en.wikipedia.org/wiki/Battle_of_Miyako_Bay
As Wikipedia puts it: Overall, during the 1920s, Japan changed its direction toward a democratic system of government. However, parliamentary government was not rooted deeply enough to withstand the economic and political pressures of the 1930s, during which military leaders became increasingly influential.