It adds a bit of depth to a character to make them an anti-hero. It often gives the more interesting motivation, whether that be revenge, desperation or one other of the many other reasons why the main character might be thrust into their question. Regular heroes tend to have no other motivation than "I want to help people," and at times that can become repetitive and often unrealistic.
If anything, story's with bad endings and dystopian settings can make people feel better than ones with peachy-sweet scenarios. They realise their lives are much better than the ones in the story. Not so much escapism as it is a chance to see how much worse things could become. A rather depressing reason to read something in an equally depressing setting, but it's just an observation.
I have no problem with these darker settings, actually. If anything I prefer them. More interesting.