You don't need a fly spell for that kind of situation, you need a spell to bring the dragon down. And you want that spell even if you don't have a melee fighter in the group, because almost every single class functions better at a range closer than 80'-160' away. Those spellcasters usually have spells with a shorter range than that, for exampe. Earthbind, Hypnotic Pattern, Tasha's Hideous Laughter, Web (sometimes), Command, Hold Monster, Sleet Storm, Slow, Suggestion, some illusions, etc.. There are SO MANY SPELLS which can bring a Dragon down to the ground and/or keep it there. And I do not buy "you shouldn't need to do this just to help the melee types" because as I said, it helps ALL types to keep a dragon from being able to fly!
If you're fighting dragons out in the open on anything even close to as often as you seem to be implying, your spellcasters better have spells prepared to bring a dragon down to the ground and mitigate that flyby attack and movement, regardless of melee types. To not have those spells may well be suicide.