I think I know a bit more about he subject than you, having studied the Edo era academically and being a licensed instructor in the military techniques carried down by one family of Tokugawa bodyguards, including the oral history that comes with that.
That era was a shitshow ruled over by oppressive sociopathic samurai where life was short, domineering, and often brutal. They kept their country isolated from technology for the only reason of disempowering potential reformers. It is only looked back with fondness by those whose naïveté keeps them from knowing better, or who have nationalistic political agendas.
The gunboat diplomacy was frankly a move of liberation that benefited the people of Japan. And it was not an occupation either -- fair trading terms were what was offered, by the standards of the day, a far better deal than China had for example. Japan was enabled by the deal, turned into a prosperous trading partner and world superpower a mere 40 years later.
I don't know what lense you are looking at his through, but it is not refracting history correctly.