We can’t help but write about ourselves. It can be incredibly cathartic to do this- being a writer has helped me though many tough periods of my life. But it can be distressing trying to write something painful directly from your own viewpoint. I’ve sometimes felt frozen, or caught up in the bad feelings that I couldn’t write a thing!
I once wrote a character and situation during a particularly troubled time in my life. I didn’t realise it at the time, but the character was saying everything I couldn’t say with my own voice. What happened is that I’d started speaking through my character, lulled into a false sense of security by my focus on her fictional life. I’ve deliberately employed this technique ever since.
The bottom line is that you will always put yourself into your writing and that is a good thing. You can use it to enrich your characters. No-one else has your personality, your life experience or your way of seeing the world. Mix this with a character with completely different life experiences to your own and you’ll create something magical.