Accidentally is the wrong word, but considering it was never done before and had some very unusual constraints (large coal supply and coal industry, sufficient centralised state that could provide peace within its borders but had been neutered into compromise with parliamentary middle class, finance centres, maritime trade etc etc) that it was done at all does feel … unplanned?
The image that sticks in my mind the most is the Meiji Emperor in a 1870s photo dressed in a saville row suit and bowler hat. For Japan the most incredible social card to play that says “we are going to be like these foreigners and their secrets to wealth”
Nothing accidental there, but that still leaves visible joins on the Japanese soul.