Kind of reminds me of this old video of Jim Carrey on impulses.

Anyway, that is scary. Sorry you are (or were) experiencing that. I can't provide ID for you unfortunately. I'm not sure if I can relate, though sometimes I'll think the exact things I don't want to think, kind of like I'm terrorizing myself with the ugliest thoughts I can think up. I think of it sort of like a self-punishment, so I try to convince myself to have mercy and be kind, and even though it doesn't seem to directly relate when I'm saying those things, it still seems to help anyway. I think it might be similar just because of how out of my own control I feel, almost as though there's a separate mind making thoughts for me and I have to think them. Your mind is kind of your sanctuary, so it makes you want to scream when it feels like it's not your own. There are many things you don't like experiencing but life events are just on an entirely shallower level than when even for a few seconds it feels like your mind has divided itself in two.