Agreed.
Imprisonment often can be traced back to unhappy thoughts, so unless you want the process to repeat itself, you need to try to break it before they're released. "Being released" generates a moderately happy thought, so that's one thing, but often not enough if they've had deaths in their inner circle or lost their only masterpiece or whatever, something truly large. You need to get them off the ledge and back to being productive, so they can generate more happy thoughts on their own.
A chain can access the 8 tiles around it (it occupies the center), and should be highest quality/value and well decorated. Your highest quality bed, table and chair take 3 of those, booze stockpiles might take another 3. If you want, you could overlap the booze with the next chain over, and let the dwarves hang out together a bit (maybe even get some social skills? mixed blessing.) Maybe a well if you really are ambitious.
If you really want to go for pro-active correctional policy, take a look at their profile for preferences, and install what they like - a cage with a cow "for their haunting moos", or a stockpile with a great sceptre (manufactured to order, one would think), whatever they will appreciate most.
Also, having your leader available for meetings (few other labors turned on) is advisable to avoid this in the first place. (Don't know the mechanics of meetings while caged/chained.)
Iirc, thoughts last about a year or so*; if so it may take a while to wait for that one deal-breaker bad thought to wear off, and they might repeat their tantrum during that time. But if they don't kill anyone new, they should break out of the cycle.
(* Not in the wiki, but thought I read that somewhere - anyone confirm/correct?)