I just remembered one other bit of info about this. The name of the volume might not actually be the name you expect. Let’s say you’re connected to a remote volume “Dork”. If you connect to another volume with the same name I think it will mount as ‘Dork-1’ or something like that. I don’t think I’ve ever run into that in real life though…
I meant programmatically that you might be able to use diskutil to find the smb mount path in the output and then figure out from that what the actual mount point in /Volumes is since diskutil will tell you the name it got mounted under
that way if its NOT always that specific mount point in macOS you could still find it