Sex while talking about someone's break-up sounds terrible tbh...
There is nothing selfish about clearly communicating what you are looking for. If anything it's more selfish to dump your personal problems on random people you are meeting for a hookup. He's just looking for a listening ear in the wrong place...
Personally my compassionate / constructive way to deal with the situation would be to tell him this:
If you want to move on, I can help you do that. By taking your mind off it and replacing old memories with new ones. But you gotta focus on the guy sitting in front of you. If you keep your ex alive in your thoughts by constantly thinking and talking about him then you're just keeping yourself trapped in the misery and preventing it from becoming a thing of the past.
If you don't want to move on, that's fine too. But I'm not going to help you keep it alive, because I don't want that and I know this isn't helping you either. When you're ready to try putting it behind you, or want a distraction to stop you from thinking about it, my door is open.