Scanning someone's ship should probably be illegal. If I were him, my immediate assumption would be they've pirates and set up an ambush for cargo.
Its probably not for that very reason, you never know if a nearby ship is a pirate one, so scanning them can be a matter of safety and self defense. Though when you have them surrounded like this, yeah it feels wrong. There should be some restrictions, like its fine to scan the ship ID, as that's the whole point of it, and that its ok to do a further scan if anything is amiss, ID not broadcasting, they are surrounding you ect. This felt like tech theft, as they were not scanning for cargo but scanning the ship itself to find out info one it as craftsman.