Dont your ship has some defenses ?
I had a perimeter of about 30-40 gun turrets shooting yellow bullets. But the pirates out ranged my gun turrets. They were shooting rocket propelled cluster grenades, lasers, something looking like tesla guns, and other weapons better than mine.
You have to destroy their terminal to your ship be able to warp out.
When I'd warp off the planet, 60 seconds later another pirate ship would attach me in space. If I'd then survive long enough to warp to another planet, a minute later pirates would attack again.
Or, they will launch some attacks, until it stops, or steal enough resources from your terminal. And then you warp normally after some time
If you cant defend this anyway, its not the end... in the worst case, get most things you can, hide inside another floor and let then steal some coins and move over.
This ended up working though. I was so focused on killing them or defending I didn't try just hiding. I was able to gather half my top level stuff and hide on my second level while they destroyed the rest of the top level, then stole resources. I was finally able to warp to space, but a minute later pirates attacked in space. They took resources for a long long while until I was out of basic resources and plates, then they left and I could warp again and rebuild.
It was kinda rough, but I'm keeping on. Thanks for the advice.