Does stopping the pill temporary for readjusting a diet helps?

(I apologize in advance if my English isn't good)

Last year, I took a new pill (the last one wasn't for me). It was also the beginning of my student life, I let you imagine : bad choices, cheap takeaway food for lunch, no exercise, etc.

Of course I gained weight. (~4kg) Then I tried to watch what I eat and took ice dancing classes. During the lockdown I avoided snacking during the day, or eat apple or a slice of bread when I cheated (guess my country) (I don't know if it's good for you to eat that instead of biscuits etc). It's still hard to this day. But I stopped taking breakfast with a lot of sugar like cookies and go on a walk instead (5km).

I saw my gynecologist to see if weight gain with the pill is a legend. She said it's more difficult for your body to adapt and to regulate : "you cannot eat fast food for 2 days and then eat carrots for 2 days after and not gain weight". It's the first time I experienced weight gain, and not being able to control what my body does is terrible for me.

I try to change my eating habits, and walk every morning, but I don't see much results which concerned me. (If you spot terrible ideas for what I described in my post please tell me)

For those who have tried, does stopping the pill help? (I took it for other purpose than not having a baby, so it won't be a problem if I stop)