Well Japan actually was a relatively liberal Parliamentary Democracy during the Taishō period of 1912-1926.
What ended up leading to the militarism and Ultra-Nationalism was the economic collapse and subsequent political changes of the Great Depression.
In the end their are two options, though one would require a late 19th century PoD.
A. Have Japan become a full Parliamentary Democracy earlier, with the Diet gaining full power while the Oligarchs and Genrō are deprived of power (which is what happened OTL), thereby giving the Parliamentary system and Democracy longer to root themselves as fundamental and core parts of government.
B. Have the Great Depression not happen, happen later or affect Japan in such a way that while it is hurt, it's not as bad as everyone else and it uses the period to focus on Economic, rather than military/territory growth.