The easiest solution would probably be to give the pirates a starbase with the upgrade that prevents loss due to bombardment. (Easy being relative, as it would be quite a bit of work for me.)
Why not give the "Pirate Starbase" an innate anti-bombardment ability?
I looked at the relevant entity file and it seemed to have 2 levels. I assume the first level is to make the upgrade available and the second activates it. If
upgradeBoolPropertyCount 2
upgradeBoolProperty "CanPreventEnemyColonize"
upgradeBoolProperty "CanPreventPlanetLossByBombing"
is moved from level 2 to 1, would the ability become innate?