In short, cortisol is secreted due to a real or _perceived_ threat, meaning that by framing everything around us as challenges we avoid activating the HPA (hypothalamus-pituitary-adrenal) axis that normally works during danger. Rats put in stressful situations showed a propensity to gorge on sweet and fatty food (cookies), since they impacted the brain just as much as natural endorphins; the rats were trying to calm themselves down after stress. The literature is monumental, one study is here [PDF]:
https://www.medicinasistemica.it/doc/biblioteca/Stress,%20ea...
There are no threats, only challenges.