Hokkaido during this era has many interesting stories that's not well known even in Japanese mainstream. There's many weird parallels to US too, during the frontier era because Hokkaido was the last frontier in Japan during the time.
The comic Golden Kamui explores this story in an interesting and hilarious way
areoform•45m ago
But essentially, gunpowder made castles obsolete. In 1450, when the English were driven out of France, the walls fell in hours. What was an essential cornerstone of military strategy and supply chains became obsolete overnight.†
Star Forts were the answer. It's a simple bit of physics, as long as the force isn't head on i.e. along the normal and can be deflected (ideally at angles shallower than 45˚) then it is more likely the fortifications will survive.
But this ends up leading to exponential cost escalation (I have the numbers converted via chickens and eggs to modern currency! Again, sorry in process >.< ) that has a significant long-term impact on the techno-sociopolitical trajectory of the world.
The fun counterfactual that no one brings up is that this didn't happen in China where the technology of castling evolved side-by-side with gunpowder over a thousand years. I think it's because of dirt. They were deliberately filling castle walls with dirt - https://en.wikipedia.org/wiki/Fortifications_of_Xi%27an / https://greatmingmilitary.blogspot.com/2019/06/chinese-forti... they were able to deform and better withstand the impact of cannon balls. But further research is needed. I'm not completely certain about this.
† I go into detail with contemporary medieval sources on how castles were used to take and retain territory, https://1517.substack.com/p/powder-and-stone-or-why-medieval