Another way of thinking about that might be that you and he have different expectations and / or are at different points on your individual time lines.
I can see why you might think that way, however it isn't fruitful. The facts are as they are, and to be honest, I believe that any line of thought where the underlying trend requires person A to behave in a manner that is not their natural way just to make person B happy is not realistic, sustainable, or desired. Let's say for a moment that you did do something. That would mean that you have to fundamentally change the person you are, and nobody should have to do that. Yes, all relationships require a level of compromise, however you should not need to change the person you are. Of course you had a part to play, every relationship has two participants, so I would cogitate for a bit and decide whether the part you played was true to your own values and work from there.
From what you've said, and based on my own life experience, I don't believe that there is anything you could have done to change the eventual outcome, and you could have eventually tied yourself in knots trying. I think this because of the way he played his hand.
It's easy for me to say, but take some time for you. Evaluate what you might have done differently, but please don't fall into the trap of living in the past. The situation is as it is, and you can only change how you approach things in future.
To expand on my original comment, there is a way to end a relationship, and there is a way not to end it. The way he ended it does not cover your ex in any glory whatsoever. Unfortunately it isn't uncommon. Find someone who doesn't need you to change the person you are. Whilst relationships require compromise, they shouldn't be hard work, and you absolutely should be free to be yourself and not walk about on eggshells second guessing how everything you do will be interpreted. I didn't realise how powerful this was until I met my wife. My relationship with her is expansive, and requires neither of us to change the people we fundamentally are. It took us a long time to find each other, but boy was it worth it.
Lastly, I have also had long term relationships that failed, and have previously spent many hours looking at the bottom of a beer glass wondering how I managed to waste so much time. Try not to do that, it is tempting, but not fruitful.