Here is a great reason to why you want to have the pirates attack you! As of right now I've only been playing with 3 normal random AIs so take that into account as well.
1. Find a juicy planet next to a pirate base.
2. Well... colonize it.
3. Upgrade all the planet health as well as tactical spots.
4. Build a couple health restore buildings and then max the rest with defensive guns. Make sure you are placing them at the phase lane entrance.
5. Build a trade port.
6. Send a young capital ship and keep it there.
7. Load up the exp to it from all the pirates! This is especially handy late in the game when level 1 capital ships are not so great, getting them to at least level 3 from a pirate raid is a great advantage. Plus pirates don't run away if there is something to kill.
Side note to get rid of pirates: If you can kill the pillager ships and the planet has no other buildings, the pirates will move on to another planet, for me it seemed like they moved back to the pirate base and went somewhere else, but check it out for yourself.