As you know neurons become linked together like train tracks and if we start down a certain memory it can take us to all aspects of that person, place or event. Also our strongest memories are linked to emotion. Which is why unfortunately we remember negative things more often if they evoke the strongest memories. That's why a happy childhood is the greatest gift.
I find the same problem as you, I feel my brain's been wired up wrong. When I'm feeling really great negative memories intrude and can bring me down. The only thing that works for me is saying it's just the machine that's faulty it's not my whole life. I try and live in the now, I had a crap childhood, that's it.
Would CBT work for you perhaps? I know someone who found it helpful for anxiety. The idea of it is to change mental habits.