There are in many cases certain attachments that are natural to the human condition. It is normal and natural to want your immediate family and sometimes extended family to love you. As humans we form long lasting relationships where we hope that our spouses and friends will become family as well and love us. However this is not always possible. Some fathers, mothers, siblings, lovers and friends cannot show or do not have the natural love or care. A normal person grieves for the loss of a close relationship. Part of the process of grieving typically involves denial and bargaining.
Sometimes this lack of love is caused by a legitimate mental illness like Borderline personality disorder or versions of Bipolar. In some cases of BPD the loved one may swing between I love you and I absolutely hate you. The smallest or largest of offenses can cause the switch and sometimes it lasts for long periods of times Hours, Months or Years. Its difficult to deal with. You always hold out hope that the intensity of the relationship will swing back in your favor.
People who grow up with mentally ill parents or experience such relationship with those they are close too have learned behaviors of dealing with rejection in a way that is not healthy for their self-esteem. It can result in any number of illnesses including pathological and nonpathological OCD, Dependant Personality Disorder or Codependency as you some what describe.