Surface vessels can also provide direct fire which is actually a lot cheaper than a torpedo. The cost of a 5" shell is something like ~20k (2k per actual shell + fuse which I assume is at least 18k) vs $5.39M(2022, source wikipedia) for a MK48 torpedo. 5" gun mounts are pretty much fully automated at this point, they have places for sailors for emergency... but on a NOMARs ship you'd just YOLO on that and use a simplified version without the manual backups for weight savings.
One of the coolest things about this is not this operating on it's own, but operating with a larger manned surface vessel or sub. They act as a cheaper and disposable escort for a much more powerful vessel creating a force multiplier. This is pretty much identical to the "Loyal wingman" that has been under development for awhile.
TLDR: there is value in having a ship being a visible target and having a gun. There is also value in having both NOMARs and manned ships working together.