Whilst every woman is free to do whatever the fuck they like when they're growing another human, I personally don't subscribe to the 'I'm pregnant, eat what you like' school of thought, and believe you can and (in my case) should watch what you eat while pregnant to avoid excess weight gain. Being over weight makes me depressed, so the last thing I wanted was a newborn and 2 stones of extra weight to have to deal with. So when I am pregnant I watch what I eat, I limit snacks, and I don't eat anymore 'extra' food until the end (which is when the guidelines say you do need a few, and it is only a few, extra calories). Watching what you eat doesn't mean you need to take in less nutrients - my diet is very varied and healthy.
In my first pregnancy I gained just one stone in total, and was lighter the day after birth than the day I conceived - meaning I lost 'me' weight during the pregnancy. I started that pregnancy only half a stone over my ideal weight (I was 11st and I'm 5ft 6" for context). It meant post birth I felt very quickly like I was back to my natural shape, and that helped me feel better.
I'm currently 31 weeks pregnant and have put on 4lbs in total, having started a bit smaller than last time. It's been tougher as I have a toddler to run after who I am also still breastfeeding twice a day, so I'm tired and the urge to grab a snack is bigger, but I've just been firm with myself and focused on when baby is here and how I want to feel.
All of this is personal to me. Some people will likely pile on and say 'I ate whatever I wanted', and all 4 stone fell off after birth/with breastfeeding (I personally never found breastfeeding helpful with weight loss). And maybe some others don't give a crap how overweight they become post birth. That's all absolutely fine for others, but I know for me, that's not how I would feel. So this is rather a long winded way of trying to say, if you do want to limit overall calories and lose weight/limit weight gain, it is entirely possible.