Seems to me that outright destruction of surface autonomous vessels would be hard to prevent, for those like China that might want to do so, and have enough resources to do it.
As far as pirates, you can make the vessel prickly enough with various kinds of isolated design booby traps at different stepped levels...
Booby trapping goes outside the "unarmed" criteria.
Also, if you were a mechanic asked to repair these boats legitimately, would you want to work on a booby trapped boat? Too easy to make a mistake.
And, if a booby trap hurt someone, they and their friends would be motivated to add their own booby traps, or mess your stuff up further.
You also need to look at the costs of sabotage vs the cost of preventing it. E.g., a simple cloth cover costing a few dollars can stop cameras. A simple wrap that goes around the boat, including the bottom, can stop submarine hunting. If they are GPS guided, a cheap signal jammer, or a faux-GPS signal (or an amplified GPS signal repeater, which messes up calculated positions because it comes from the wrong position, with a time delay, and overpowers the real signal) can probably be made very cheaply. There are obvious expensive ways to attack GPS jammers and faux-GPS signals, but they aren't cheap. Again, cheap foil blankets or wire nets can block antennas.
It's a little like fighting guerilla warfare or terrorism using conventional forces. In the long run, it's nearly difficult and expensive for the conventional forces to win. Of course, in that case, the guerillas or terrorists have to have people willing to sacrifice themselves for a cause, but that might not be needed to fight autonomous unarmed boats. Even if you have nearby fighter aircraft or chase boats to go after the saboteurs, they could do all the bad stuff from cheap airborne drones - so all they would destroy would be the drones. It's bad enough to fight off drones from manned vessels. But from unmanned unarmed vessels?
Plus, attacking a manned vessel is an act of war, which opponents may hesitate to do. But maybe not attacking an unmanned vessel. That's maybe just a fun prank, something a bright child could do.
In other words, I think these things, especially if they have military purposes, would have to fight an economically unbalanced battle, that can't be won. That hasn't stopped contractors from developing and selling expensive autonomous boats to the government, because funding was made available, but I think it was a bad decision by the government sponsors.
Mind you, there are obvious applications for small cheap stealthy autonomous vessels. Like mapping bottom topography, looking for clear channels, setting mines, reconnaissance, remote sniper work, etc. Maybe they could look for schools of fish, or monitor water pollution. But that submarine hunter isn't cheap, and it looks way too easy to detect and mess up.