True Polymorph is a 9th level spell, on par with Wish, so it should be awesome. As others have pointed out, there should be some limitation on the ability to manipulate the hydra. Additionally, each time they're hit to grow a new head should create a Con save to maintain concentration, which should significantly reduce the probability of success. Even if they happen to succeed, there are ways the BBEG and prepare to stop it.
If the BBEG isn't a caster, give them a way to have Antimagic Field; this will significantly hamper the party, as the melee characters will have to damage him enough to break concentration first. If the BBEG is a caster, and they should be for this high level a combat (or at least have minions that can cast), the following spells should take care of the mega-hydra: Maze, Forcecage, Psychic Scream, and for a cruel twist Dominate Monster. Worst case scenario, you can force a small passage to get to the BBEG, preventing a huge creature from getting through.