I pretty much exclusively use Berserkers, there are ways to keep your thrall from getting dementia and if you follow the list below you will likely not have them bug at all.
We’re going to call this a passive state.
When the thrall has their weapon out in hand we will call it active.
Never change a weapon when your thrall is in an active state. It’s going to be 99% chance to bug.
Most of the time you’re probably running away from a named NPC to keep your thrall from killing it. When you do this look behind you to see if your thrall is running backwards or facing the enemy while following. If it is, it will likely still have its weapon in hand. If you swap weapons at this time you’ll bug it. Try to find something else to kill to get your thrall back to a passive state. (Best way)
If you can’t kill something else remove a piece of armor from your thrall and replace it. This should move the weapon into the thralls inventory instead of its hand. Then swap to the truncheon. This works about 75% of the time. If this doesn’t work you can place the thrall on guard and repeat the process with the armor removal and replace them tell to follow again.
I only allow 2 weapons in the thrall ever, and always 1 at a time. Their killing weapon and the truncheon. If one is not working they are looking for the other. Allowing them to kill something with the one they want to use and then entering a passive state fixes the issue 99% of the time.
For the 1% of the time I break one of my rules I give them both weapons and let them choose what they want to use. While they are using it I remove the other weapon. Once passive switch to what I want.
If none of that works, which has never happened to me, but others have stated it doesn’t always work. A server restart will fix them up again.