according to the DF wiki, being cooped up cannot directly cause insanity, the fallowing causes of insanity are:
The strange mood job is cancelled for some reason (e.g. the claimed workshop is destroyed or a magma forge loses power)
A Diplomat is trapped inside your fortress for a long time after having completed its meeting. (Being trapped inside a fortress without having completed their meeting will not cause a diplomat to go insane.)
A Diplomat is attacked by sieging forces
A Merchant is trapped within your fortress or otherwise disrupted (e.g. by being attacked by invaders).
A dwarf is forced to stay awake for over 6 months ("Very Drowsy" for a month and a half).
A dwarf is under excessively high stress. Dwarves who have completed a strange mood and created an artifact cannot go insane this way.
A dwarf enters a strange mood but is waiting inside the claimed workshop for the next item (or hasn't yet claimed a workshop) for a month and a half.
A Diplomat or merchant is trapped inside a cage.
your vampire isnt a diplomat, so that rules those options out, you would have noticed if they strange mooded, vampires dont sleep, and so the only possible way for him/her so go insane is if they have high stress.
i find it unlikely that your dwarf is in a high stress environment due to being locked up, however if they are mentally feeble and have a low tolerance for stress, their stress could build up enough over time to make them go insane.
according to the wiki, dwarves DO start to act weird if they are about to go insane from stress, so this is a feasible possibility.
i am unaware if unmet needs can cause stress as most of my dwarves needs are sufficiently met for it to not cause a big issue, but if it can, that could be the cause.
now heres where some fun comes in, insane dwarves will eventully die because they cannot eat drink or sleep, BUT vampires dont need to eat drink or sleep, so if they go insane, they will still live forever. if your vampire goes stark raving mad, you should let him free, and elect him your baron when you get the option to, because theres no better noble than an immortal, insane, naked, lazy noble who does nothing ever.