Castles were important in the middle ages. And not just because of foreign threat.
“Castles – in the absence of castle-breaking cannon – shift power downward in this system, because they allow vassals to effectively resist their lieges. That may not manifest in open rebellion so much as a refusal to go on campaign or supply troops. This is important, because it makes lieges as dependent on their vassals as vassals are on their lieges.”