CBT approach and why we generate unrealistic thoughts On reading about Cognitive-Behavioural Therapy (CBT)
 I encounter


  But, if you feel sad after a friend cancels your lunch plans and you
  begin to think there’s obviously something seriously wrong with you
  and no one likes you, this is problematic because this thought is
  extreme and not based on reality.


This makes sense because concluding that none likes you from canceling lunch is overestimation.

But my question is different: how or why are we generating these unrealistic thoughts in the first place? Especially given that after some challenging these thoughts, we can correct them ourselves. So if we can correct them ourselves after challenging them, why do we generate these unrealistic thoughts in the first place, and not the correct ones?
Another way to phrase these questions would be:


Why do humans feel fear and anxiety?
Why are humans particularly sensitive to potential losses See: https://en.wikipedia.org/wiki/Loss_aversion


In the broadest terms, the answer is that we evolved to have these mental characteristics because they probably gave our ancestors a survival and/or reproductive edge over their contemporaries. In the past, humans needed to be socially accepted in a small tribe; exclusion meant actual death as it was too hard to survive alone. Hence, we evolved to be hyper-sensitive to signs of social exclusion.

Your final question might be:


How come we can't control our feelings with our thoughts?


See the first point above. It didn't help us survive to be calm and at peace.