Hoo boy. I think escapism is a huge part of it. The thing about fictional characters is they tend to be created by other people trying to get you to love or hate them instead of being real people who sometimes just act randomly inconsistent for no reason. Real people either change too much or not enough but fictional characters, when done right, are presented exactly the way they want to be seen and media can provide a level of context and insight into their experiences that would be kind of creepy to get from any normal person.
The first time I felt an intense urge to ctb was when I finished playing Fire Emblem Shadow Dragon and felt like a horrible monster for beating the game but letting all of the characters die (except Marth). Just the fact that I was responsible for guiding these game characters to their permanent death made me feel like such a useless person that I had to procure an Action Replay to hack the game and play through it again with as many survivors as possible.
In 2013, I played Fire Emblem Awakening (on casual mode so I could avoid the ctb feelings from before) and got so invested in the story, especially Lucina. I think Lucina became the representation of just about everything I would love in a person. Marrying her ingame helped me get over someone in reality who I was unhealthily obsessed with. Unfortunately it seems I have replaced it with an obsession for her but I'm more okay with that BECAUSE she's a fictional character. Every Fire Emblem game since then has found ways to really suck me into their worlds though, even Fates, but not in the same way Awakening has.
Also I cried more for Iron Man's death than both the deaths of my grandparents combined who died earlier this year. They weren't even terrible people and they basically raised me when I was 3-5 years old but I guess their deaths just didn't affect me as much, probably because I'm a bad person etc etc.