It's definitely true that eating less/healthier is the most important part of weight loss. However, perhaps because exercise played a big role in my own weight loss journey, I do feel like people go too far in dismissing it as a weight loss aid.
First of all, while a 3k run isn't going to do much to burn off that slice of cake you had with lunch, if you transition from a generally inactive lifestyle to a generally active one (eg, by getting into running as a hobby), you can cumulatively burn a decent amount of calories. Cardio as a hobby is not for everyone, but I thought it wasn't for me until I gave it a shot and found I really enjoyed it.
There are also psychological advantages of incorporating exercise into a weight loss regime. I started eating better after, and partially because, I started exercising. When you work out a lot, you start to enjoy feeling healthy (or at least, thinking of yourself as a healthy person), and you start to realise that junk food is working against that.
Finally, weight loss should not be your only goal if you are interested in getting healthier. It's true that you could lose weight by being very sedentary and eating very little, but I suspect that would bring its own health problems.