could you prevent the entire battle for the castle by sending a (small/one man) counterattack to the attacking province?
__________________
Want a blend of fantasy and sci-fi? Try the total conversion Dominions 3000 mod with a new and fully modded solar system map.
Dragons wanted? Try the Dragons, Magic Incarnate nation.
New and different undead nation? Try Souls of Shiar. Including new powerfull holy magic.
In for a whole new sort of game? Then try my scenario map Gang Wars.
The only way you can get attacked during the same turn and sieged is if you get an indie event like barbarians on the same turn as you storm the castle. Or if you had one sometime during the siege, because that invokes a specific bug.
The province I was in was attacked by barbarians the same turn as I stormed the castle - ended up with my forces inside (yay!) and the barbarians laying siege. Last mistake they ever made.