Yeah, a golem-type forgotten beast will end your fort without question if you aren't prepared properly. I know they used to be effectively immortal versus attacks, because their vital components could never be destroyed by any amount of damage and they remained threatening and mobile even if you cut off everything else. That bug may have been fixed, but on average, material-based forgotten beasts are far more vital and damaging than ones based off living things. If you don't have a well-suited and trained military you'll probably lose everyone to it.
The other alternative is, you build a device with a support linked up to a lever that will cause the ceiling to fall and crush the ground beneath it. You engineer it so the golem walks under it, and have someone (P)ull the lever. It will be killed without fail as long as you time it right and build the trap correctly
- This works with both natural rock and constructions
- Kills all types of FB--special care is needed to make a sealed system to protect against flying FB, who will simply fly around the trap, however.
- Forgotten beasts never set off pressure plates. In order to time this right, you need a dwarf locked in a room with the lever that triggers the trap (or put it in the meeting hall).
Another fun way is magma. FB love to destroy things you've built, so the easy way is to put a floodgate along the path they will attack your fortress and have magma behind it. They will unerringly destroy the floodgate and get melted.
Since they destroy things, one way to protect your fort from non-flying forgotten beasts is to make the only way into the fort require crossing a grate or bridge. They will attack the grate\bridge instead of crossing it, and then be unable to get inside.
Flying FB are not at all uncommon, though. So... Good luck!