One thing you should keep in mind is that magic is a limited resource. Melee types can swing their weapons all day long. Well, so long as they don't run out of the HP limited resource. Archers and the like are limited by their ammunition. Spellcasters are limited by their spells/day. Of course, scrolls, wands and similar items can buff that up as well.
So, spellscasters do a good job of using limited resources to spike huge amounts of damage at a time. Melee specialists just swing and swing and swing. Especially since the concept of combat fatigue is abstracted into HP. Over the course of a day, a melee combatant can dish out more damage than any spellcaster.
But that is not how most adventuring groups work. Everybody recognizes the value of the heavy spells. So when a spellcaster begins to run low on spells, most adventuring groups will choose to fallback, regroup and replenish spells. This is natural. If you want to maximize survivability, you minimize your weaknesses. But it does help push spellcasting to a more valuable presence in the game.
So how do you change that? Well, you present scenarios that are designed to drain resources as well as placing time constraints on the story. Use attrition to emphasize the groups reliance on magic solutions. Give them 13 hours in which they have to break into the cults hidden lair, fight their way to the room where the ritual is being held and then stop the ritual. Then construct the scenario so that they have to go through several challenges to reach that goal. Force them to make difficult choices and if they fall back to regroup, they fail to stop the ritual. Bad things happen and they are left with the knowledge that they wussed out rather then stop it.
Of course, if your group has never dealt with this before, it might not be well received. "It wasn't fair", "there was no way we could win", and other similar battle whines might be heard. No, it might not be fair. This is a cult trying to reach a goal. Do you really think they would leave themselves unprotected at the height of their ritual? Make sure there is a way to win, but don't make sure it is easy. Failure is part of character development. Taking big risks is part of being a hero. Victory in adverse conditions is all the more sweet.
In the last campaign I ran, the heroes chose to journey through "The Impassable Forest". This was a little scenario that I called Attrition. The PC's would be attacked every 2-6 hours. They were torn between staying in one place to get rest and never advancing, or moving forward and hoping they could withstand the onslaught. They eventually won a brief reprieve when they neared an outpost they were looking for and hunkered down in hiding long enough to prep an assault. That assault didn't go very well, but they did win. Then they had to journey further into the forest to move closer to their goal. The lowpoint came when they neared the area controlled by the yuan-ti. This was the goal they were aiming for, but they managed to get a patrol of yuan-ti rangers on their tail. This patrol called in two other patrols. The three groups of three rangers would take turns. They would sneak up on the camp, launch arrows into anybody sleeping, drop a darkness on the camp and leave. There were 9 of them and each can use darkness once a day. The spellcasters were next to useless after a while. They couldn't rest long enough to get spells because each time they tried, they would get hit with arrows.
The group averaged 6-7th level at the time.
They eventually prevailed and were victorious. It took a lot of hard work and they struggled greatly. But the players still show a certain amount of pride at having succeeded and none of them think the melee combatants are nothing more than fodder. They know that the melee combatants were the ones that eventually won the reprieve that let them regain their rest, and spells.
It was a fun scenario. I kept thinking they would turn around and flee, but they kept pressing onward until their only option was to go forward. The groups tactics improved a bit. They later encountered situations where they would have liked to have fallen back to regroup, but they knew they didn't have the time. They dealt with it and I think almost every single PC had a moment where they could shine in that campaign.
So yes, magic is an important resource in D&D. But it only overshines everything when the group allows it to. As DM, you can force them to rely less on magic. Or at least to use their magic more effectively than in big evocations. Sometimes a scry or a wall spell will have infinitely more value than chain lightning. Force the players to look at different options by putting the PCs in peril with tough decisions.