This is not a fix though. You've just pointed out the biggest problem. Some people are saying you can solve this by setting up elaborate patrol routes to keep them in. The problem is, then you have to avoid all naval conflict, because every time you get into a war, you have to put all those ships in port. If you do, dozens of pirate will start spawning. Because they are spawning you can't get these ships safely out of port until you bring along a larger navy. If you go the other route and keep a ship or two in each necessary port, then you could be doubling the number of ships that requires. Either way you go, you're devoting a huge portion of your navy merely to hunting pirates. To say this is fun is ludicrous. It's basically taking away naval combat to poorly simulate a somewhat unimportant historical factor.
in HttT, you don't need to set up elaborate patrols. Just have ships in a select few harbours.