This is one I’ve figured out for myself. It actually didn’t take much figuring out, but it was just a connection I’d never made before. Or I did make it ages ago and then forgot about it? Seems to happen more and more these days… Where was I? Right, back in ye olde days
when an invading army was laying siege to an impregnable castle
one of the methods they would use, once hurling large rocks and cuttingly sarcastic comments at the defenders failed, was to dig tunnels some distance from the walls and work their way until they were beneath the stout walls of the fortress. They would then plant explosives to cause a breach in the defences and allow their army to enter.
Thus they had undermined the castle, in the way today that we undermine someone’s argument, confidence or whatever.