Understand the game. You meet someone, and you both have needs. You spend some time together, make each other feel good and bad, and then it ends. There is nothing special about it; you are like the billions who lived before you.
Don't take what happened so seriously. You are not that important, that relationship is not that important, and your ex is not that important.
A great deal of what you are feeling is because of your psychology. You have an anxious attachment style, which means you catastrophize, overanalyze things, and want everything to go your way because you need reassurance to feel safe.
Yes, it would be nice to have a big, healthy family where everyone loves each other, living in a big mansion with your mom and dad next door, along with grandparents, grandchildren, and unlimited resources. Look at the reality around you and what is actually happening. Stop trying to force the current situation into your ideal model of the world; they are not the same thing.
Get up, shake it off, and get ready for the next round. You did it before, and you can do it again. Don't be trapped by dogma and fear either. Be very cautious here. Those emotions can crash you down to the ground if you are not careful; isolation, chronic anxiety, and invisible fear. Fuck those negative emotions that keep you weak, insecure, and stuck where you are. You have to actively say, "I do not tolerate this pain." Like parenting a child, you need to parent your nervous system.
We have work to do. Make a plan for what you want. You have needs that need to be fulfilled, and no one will do it for you.