That depends. Post game I defeat a lot of wild pokemon in battle to obtain certain evs or to make a chain while shiny hunting with certain methods like the dexnav.
In the main story I face my fair share of wild pokemon early game for the experience. As Sheep said, after the 1st or 2nd gym I tend to feel more secure about the level of my pokemon, and will usually opt to dodge wild pokemon if I am not going to catch them. Since I meet eyes with every trainer I can find all of the trainer battles are usually sufficient to keep us in shape without additional time-consuming confrontations with wild pokemon that don't yield much exp.
There are exceptions though. If I catch a pokemon that I really like then I will sometimes stop story progression for a little while to level grind with that pokemon and help catch him up to where the rest of the team is. It has to be a pokemon I am really excited about and think has a bright future on my team, but when I find that special mon I will work to get them some wild pokemon to battle to help them grow. It just is so worth it to have a psuedolegendary for instance on the team.
I also try to get my whole team some extra levels in before the pokemon league. We tend to do a lot of wild pokemon battles on Victory Road together after we have finished fighting all the trainers. I want to be ready for the Elite Four.
When I am doing a monotype and there are gyms that I have a disadvantage against I also tend to put in overtime.
So I would say I'd say there are definitely situations where fighting wild pokemon has it's uses.