(((((((((Berries))))))))))
The same thing happens to me a lot. Less so since I've been in counselling, but the obsessive thinking starts to crop up whenever my depression gets bad and then it's very, very difficult for me to really grasp others' reassurances no matter how many times they repeat them. It's incredibly frustrating, isn't it?
Is there anything you can do to distract yourself? Any kind of mental switch you can flip to hit the brakes on those thoughts? Personally, I count. Backwards. In French.

Any kind of mind games helps for me, just simple things like repeating the alphabet or bits of poetry I've memorized or trying to play my favourite movie, scene by scene, in my head. The trick is to concentrate on that simple mind game REALLY REALLY HARD. It's taken a LOT of practice and it didn't work the first few times I tried it, but little by little, I was able to slow down and eventually stop those thoughts from circling.
I don't know why you have that glitch in your brain. What I do know is that you're still a kind, caring person despite it, and it's not your fault that glitch is there. Take care of yourself.