It's funny I should come across this thread now, because recently I've become aware that I am doing this. I don't know if I'm doing it more than I used to or I'm just more aware of it now.
My department at work is me and another person, and the last two days before they were asked to leave I was working on a character for a new campaign. My coworker is interesting to talk to about music and art and raising kids, but also talks about people behind their backs in unkind ways. They were increasingly agitated by work and home-life problems, and they were taking it out on people. I was making a character with a very "surfer dude" vibe: laid back, no affectations, no problems, takes things as they come, doesn't take things personally, etc. My coworker was let go - temporarily, I assume, but it's been 3.5 weeks now. During that time I've been doing the work of 2 people, so it's been pretty hard - but having my dude to role-play every week has definitely been therapeutic.
Before that, I ran a cleric with a soldier background who had seen war, didn't like to talk about it, had committed himself to peace and healing and helping those in need, but every time he was confronted with injustice he got very hostile and violent very fast. I realized pretty quickly I was inappropriately directing some of this hostility at our DM, letting my character's anger directed at the DM's NPC bleed into our real-life interaction at the table. I put the kibosh on that and luckily we've moved on to the new campaign with new PCs, but I'm still looking at what was bubbling up in me there. The dude character is also probably a reaction to the hostile cleric character.