The 5 minute workday in the dungeon rotated back into discussion again recently. I'm not sure if the context was 5e, Dragon Age or what, but this is one of those things that pops up from time to time in discussion.
I'm not going to delve too deep into this issue itself for one simple reason: this is a solved problem. Rules have been designed with robust magic systems that don't have this issue, and adventure design has (I hope to god) advanced to the point where if you tried something like this it would work about as well as you might expect (which is to say, not well at all).
Seriously, if you are actually having this problem at your table, not just discussing it as a hypothetical possibility, then it's time to check your fundamentals and hit the weights.
But if you're working to avoid this problem, then you have my sympathy, because there definitely are games that reward this behavior, and it can really feel like it's your fault. Odds are, it's not. Most likely, it's a failure of the fiction.
A failure of the fiction is something that occurs when you stop and think about how things work and conclude that something really dumb is afoot here. Often, these are rules constructs that we ignore for the same reason we do puppeteers - the most famous example of this being hit points, and what exactly they mean in the context of actual reality. The image of the high level fighter walking around filled with arrows and feeling fine is a common touchpoint for D&D humor. These things can violate our common sense, but we can tolerate them to a point, so long as they make the game more playable.
For magic, things get much more complicated. Because we don't have a personal frame of reference for how magic works, we are dependent on the rules to establish our common sense, and we don't have the same buffers in place to fill in the gaps. We understand the silliness of a "hit point" and we can at least try to not do things like jump off cliffs because we can totally take that 10d6 hit (or at least recognize it as preposterous), but we have no such check in place for a "mana point". There is no "gut check" to say that it's stupid to burn all your mana at once. The only guideline is the rules, and the rules generally don't necessarily have very good judgement.
And the problem is, of course, that magic is very rarely that mechanistic in fiction (even in the fiction based on these games). It has a logic and a sensibility that writers seize upon, usually by departing from the magic as presented in the rules. And that's the rub: the creation of a magic system is a profound act of worldbuilding, but when a game design fails to bear this in mind, you get crazy disconnects.
Now, the good news is that lots of games have solved this problem. There are tons of games with flavorful, reasonable (yet still magical-feeling) magic systems. And they totally deserve to be stolen from.
1 - If you don't know the term, it comes from a practice in older editions of D&D where the spell casters would load up on spells, then the party would walk into the first room in the dungeon and unload all of their most potent spells to overwhelm the opposition. Then they'd bar the doors and rest for however long it took to recover and re-memorize the spells, then proceed to the next room and repeat the process. It was neither heroic nor adventurous, but it was super efficient. Most games where Magic is a limited, burstable resource run into this problem.