The millitary rule was initially created to guarantee the safety of the freed Slaves in the southern region, but over period of time, the millitary rules seems to be less necessary since the majority people had accept the fact that they could no longer treat the African American as slaves (even though many still not happy about it)
On top of that, <span>Rutherford B. Hayes received a lot of pressure from Democratic party at that time and being threatened into a filibuster if He refused to did a compromise and retract the last remaining troops from the South.</span>
Answer:
Split the Government into a Diarchy type situation
The Emperor leads Domestic Affairs, while the Shogun leads Military affairs within japan, create a parliament full of the daimyo so that internal politics becomes easier, and have the samurai act as Guards for important people in government.
This is just a brief idea, and the Shogun would likely just take back control, although I believe you can provide the checks and balances.