I think that @dabbler is correct. Through out one’s life coping mechanisms are devised. When a situation arises that defeats the current mechanism, an earlier mechanism is attempted. Eventually, after a succession of failures to cope, one reaches the mechanisms created during the early years of one’s life. Some mechanisms are infantile. When frightened, or merely startled, the infant seeks the presence of one who protects. The lack of this presence increases fear, which motivates a coping mechanism’s creation, and crying usually proves successful.
It is sad when love is not enough to maintain a relationship. One’s mind has a tendency to filter out memories of pain leaving mostly happy ones. If onlys, could have beens, and other similar thoughts when stressed recreates love’s fantasy found only initially. Stay strong, you really do not need him along with the reasons the relationship ended. What you need is within you. Maybe counseling would help you to find it there, but know that it is there. Good luck.