That comes down to the location and type of castle, nothing to do with period.
https://en.wikipedia.org/wiki/Caernarfon_Castle
has town walls, water on three sides, multiple independant keeps separated by curtain walls, etc. Once attackers "gained entry" they were faced with being in an enclosed space, surrounded by high archers, and tasked with as much work again to advance further ... only to be faced with the same again.
It was damn near impossible to siege as restocking from the sea and|or river was almost always an option at the time.
It was also a castle with decades of resources and cash thrown its way, other castles of the same period didn't fare nearly as well.
A great many of the Irish castles of the Ulster plantation and onwards fell to undermining - Irish sappers dug tunnels and propped the undersides of the walls .. only to later burn out all the props and collapse the walls.
There were only so many castles that had water access, multiple layered defences and granite foundations all about that resisted tunnelling.