For me, spawn camping is equivalent to being sunk - you've lost. As such, there is a tool for this, as other have noted, in your ability to Scuttle the Ship. This will force your Ship to sink, and the attackers will not be able to prevent this long even if they directly try to. So you just chill on the Ferry for a little bit longer and respawn at your fresh Ship away from the attackers.
There can be legitimate reasons to keep your Ship alive longer than you may like, such as taking your supplies to restock their own (this may or may not have been the case). Maybe they are working on sinking you (again, not saying for sure this was the case in your situation here) and need to keep you dead to ensure that you don't try to repair and save the Ship. Is it thrilling to have done to you, no, but the control remains ever in your hands as the defender.
Invulnerability is something that was actually looked into in the past. What was found is there was no actual sweet spot where it effectively changed the situation but didn't provide some hefty advantage to the defender (who now has a big advantage in the cases where more legitimate reasons are in play).
I get it, a lot of people don't like to Scuttle and want a chance to fight back. The thing is, you had your chance to fight back up to the point in which they were able to start Spawn Camping you (sort of like if they sunk your Ship outright). Yes, you will lose your treasure and your stocked supplies. But if you have lost, and if they just sunk you like you imply you would prefer, this would already be the case.
So, take your loss and move on. Plus, if they are raiding your supplies and you Scuttle you cut that off for them and they won't get the rest. You can actually deny them their gains, but a little bit of sting back on them (if they care strongly enough).
The best solution is to try and develop the mindset of not caring so much about outcomes and start finding the joy in the action packed adventure you're having - win or lose. As the code says, be a good sport in both winning and losing.