Right,
I had known my ex for 22 years. I went out with him again after I divorced my first husband. I was with him 4 years. One day his front door key to my house was posted through the letterbox, then he blocked me on everything the same moment. I went to his apartment, same as you, worried for his sudden change of heart - he wouldnt answer the door. After 4 years. We never spoke again.
There not mad or dangerous or unhinged and 9 times out of ten its that they simply want to meet somebody else but don't have the balls to say it out loud to your face. You didn't do anything wrong, relationships end.
You've not 'dodged a bullet' and we need to stop demonising people as if they are somehow rejects from society instead of just being a bit shit at ending relationships, because how it ends can really hurt someone.
Your self esteem needs to come from YOU, always. It can't rely on another person because other people don't have your best interests at heart at the point where they have to choose between your mental wellbeing and theirs, usually.
You'll be OK, OP and you'll find better - I did. Just keep your heart and eyes open and don't let this horrible feeling of rejection cling to you. You weren't rejected because of anything you did, he just wanted to move on without having the skills or decency to let you down gently. That's on him and no longer your problem.
As long as you wouldn't handle the same situation in the same way he did, you're morally doing ok and you deserve to find someone better suited to you. Get back on the horse.