It's true that there is a theory that our body has a “set point” weight range it tries to maintain. If you go below it, hormonal changes (like increased ghrelin and decreased leptin) push you to eat more and regain weight.
I do find it mind boggling how much, despite a healthy weight being good for us biologically, our brains and bodies seem to do everything they can to keep us overweight despite our efforts.
The whole song and dance of too many calories = weight gain versus too little calories = also weight gain cuz your body thinks it needs to hold on to fat, etc etc.
Also was listening to the Fat Science podcast (highly recommended) and the doctor on that discusses how even you simply feeling guilty for eating a certain food, or not liking your weight on the scale can trick your brain into thinking food is scarce, results in you guessed it, further metabolism slow down. It seems that when we try to lose weight, especially in ways that feel restrictive or stressful, our bodies often interpret that as a threat, triggering biological responses that make weight loss harder.
It really is a minefield of obstacles to navigate through to lose weight isn't it.