Impregnable underground defenses?
Solution 1:
A raised drawbridge or retracted bridge over a moat will stop all uninvited guests that can't fly. As you have noticed they are building destroyers so the drawbridge can be destroyed by a Forgotten Beast and it is no better than a retracted bridge to stop flying FBs.
A retracting bridge has the advantage of allowing you to make a manual trap if you time the closing of the bridge properly. I suggest you use a long bridge that leads to a long fall on spikes traps. As soon as you get the message about the uninvited guest, send one of your dwarf in the room where the lever to access the bridge is located (lock him there). It takes some time for the bridge to retract: you will need some testing to determine the optimal time to pull the lever (use pause then . to advance the game slowly). Long bridges are advised to let your dwarf some time to pull the lever -- dwarven stupidity should never be underestimated.
FBs don't activate traps but the spikes in the bottom of the pit don't need activation: they are always on. I'm not sure about the optimal fall distance but a fall of 10 z-level on steel spikes made short work of my last uninvited guest.
Flying FBs are another matter I suppose. I haven't played long enough to get flying Forgotten Beasts but I'm sure they exist and you will have to either wall the cavern entrance (b C constructions can not be demolished by invaders) or confront them with your army.
Solution 2:
Walls. Nothing can destroy walls.
(Well, except for cave-ins, that is. And dwarves, of course, if ordered to do so.)