I just want to confirm that you mean 5 divisions. As the units I can build are battalions, that means I would need something like 45 battalions to make 5 divisions (3 x BN = BDE / 3 x BDE = DIV).
If the game refers to each infantry unit as a battalion, then I mean battalions.
If pirates can build a base when they have 50% control, there must be some way to "fight" them before they gain 50%. So how do I find out that there is a growing pirate control problem so that I can stop it before it gets to 50%? And I now know how to attack a pirate base, but how do I fight pirate control before they have a base?
Pirates gain control at a colony by maintaining a military presence over the colony or by successfully raiding a colony. If the only pirate activity in the system is an occasional raid, then the pirates are unlikely to be able to gain enough control at a colony to build a base. Unless you're facing a fairly strong pirate faction, a couple of size 250-300 frigates is sufficient naval presence to drive off the occasional raiding pirate ship and a decent garrison, such as 5 infantry units, is sufficient to defeat the majority of pirate raiding parties even if you don't have enough naval presence to drive off the raiding vessels. A Hidden Pirate Base will prevent the owning faction's control level from dipping below 50% for as long as the base remains intact (base destruction usually means you attacked it and defeated its defenders, but if I recall correctly there is a chance that pirate raiders will destroy the base if they aren't of the faction that owns the base).
I will also add that it becomes much, much more difficult for pirates to maintain control over a colony as its population grows. If the planetary population is over 2 or 3 billion and the planet does not currently have a hidden pirate base on it or being constructed on it, you most likely will not need to worry about pirates gaining sufficient control over it unless it's constantly suffering very large raids or there's a big pirate fleet orbiting it and not leaving (which is about the only way to be suffering constant large raids at a colony, anyways).
If you detect a hidden pirate base before it's been completed, then you should attack it as soon as possible as I believe that the pirate bases don't resist attacks as well before they finish construction.