This is a generic problem, because the PCs can essentially always do this in a boss encounter, but lacks a generic solution that doesn't arbitrarily obviate Polymorph. There is nothing wrong with players using the strategy some of the time, and is only truly a problem if they start using it virtually all the time. It's the latter situation that indicates a closer-to-broken game.
Make things less predictable for your players
The biggest issue with this situation is that your players have identified a strategy that is reliably effective enough to be worth hazarding a spell slot to try essentially every significant-seeming boss fight. If you change that formula, you can disrupt that calculation.
My main go-to solutions in that direction are things like making spell slots directly useful in other ways (both using spells for other things, and using spell slots in novel ways, like to power magical constructions). But creativity is your friend-- the goal is ultimately to break the connection between Polymorph and easy boss fights in your players' minds. Wild magic fields that produce unpredictable consequences for casting higher-level spells, obstacles that break line-of-sight on the boss character, and magic-negating zones of the battlefield are examples of some other ways to disrupt the dominance of the strategy without just saying "Polymorph simply doesn't work here".
Concentrate on concentration
Since a character must concentrate on maintaining Polymorph to enjoy the benefits of this strategy, and a character can only concentrate on one spell at a time, you can adjust how desirable Polymorph is over other things your caster(s) might do. If the druid has another spell effect that requires concentration, making that a central part of the fight can prevent the Polymorph strategy from being attractive. You can also populate combats with mooks and traps designed to specifically force concentration checks.
Dispel Magic is easier to use than Polymorph
It's not that hard to toss a spellcaster or two into a fight, and even less difficult to give magic items to the NPCs. Access to something like a Wand of Dispel Magic, if you choose to homebrew such a thing, can make Polymorph-ing less worthwhile (much less worthwhile if the wand casts at 4th level or greater). Magic items that can cast Dispel Magic, or spellcaster NPCs, can also be used for things other than hard-countering Polymorph and so may not feel quite so targeted at the players' strategy.
A dominant strategy is a fun discovery for players, so letting them abuse it for a little while can be exciting for them. But there is no reason that their antagonists can't find out a bit about how the PCs are dealing with enemies, and so if they use this strategy more than a couple of times it's reasonable for their opponents to make preparations to deal with it.
Just say no
I, personally, dislike using this kind of approach and avoid it where I can, but sometimes there are no better options. There are hard counters to Polymorph, most notably giving your boss NPC Legendary Resistance or the Shapeshifter trait.
Talk to the players
One of the things that makes D&D exciting is the possibility of failure. If players devise a strategy that effectively cannot be beaten (short of the DM arbitrarily declaring that it's not going to work) then that element of the game is gone. I don't think that a Polymorph-based strategy necessarily fits that, but if you are averse to the hard counters and arbitrary rulings being in place all the time to prevent it you can wind up effectively in that spot. In such a case it's fair to say to your players something like
You've done it! You've won D&D-- without changing the rules, I'm not going to be able to design combat encounters you have a chance of winning without you being able to win them trivially. I'm open to other ideas if you have them, but if you want to keep playing this way then this campaign is basically over, because you've won D&D. Do you want to keep playing?
They may have other solutions in mind, but in my experience players prefer to limit their game-breaking activities over playing a game so broken that it has no excitement. It's a good opportunity to clearly mark that things will change, if not immediately then soon, to nerf the strategy and restore tension to the game.
When my players come up with what they think might be an overpowered approach and ask me about it, I generally tell them that even if it will work as they envision now it may not always work because I have a responsibility to keep the game fun and exciting-- I will not allow an I win button in the game. This has been enough to keep them from using those strategies all the time: it's more fun to have them available in a critical moment than it is to never get to use them at all.