Caving in the workshops is a bit of an overkill (but that's how I'd kill a fire breathing steel spider FB). Cage traps will help a bit, but you still have the problem that most of the time you want the militia on hand to kill the "normal" undead hair and skin, but as soon as you get head hair/skin you need them to be far away or they'll probably die, either from exhaustion whacking on the unkillable thing, or from thirst/starvation in a cage while the other militia are dying from exhaustion (well, they'll actually die from dehydration or getting killed by the head thingie). A single civilian can quite often be secured in a cage trap, but if you cram a squad of militia in there to handle the lesser emergencies you're going to more or less run out of traps to randomly dodge into.
If you had the militia in there when the head undead appeared you need a lot of cage traps outside to catch the resulting undead. You will also have the facilities off line for months while the militia slowly dies. Also, in an embark where animals in cages frequently dies of extreme heat while hauled to the fortress the caravans were slaughtered by these dead animals being reanimated OUTSIDE of their cages. Thus, I wouldn't be surprised if dorfs dying of thirst in cages would reanimate outside of those cages.
I disagree with the appearance of completely immortal enemies in fantasy games. There should always be a way, even if it's complicated and requires extensive questing, and regardless, the immortal top bosses shouldn't randomly appear in the middle of your fortress without a really significant reason (which wouldn't make it randomly), such as stupidly opening a portal to an unknown, or poorly researched, place in your library.