Computers are not good at detecting evil. Meaning that you cannot make an automated test which can tell you if some software, which detects USB device plugging, is "malware" or "not malware".
As long as a machine:
- currently runs malware (i.e. is subverted);
- and can detect at all that a USB device is plugged;
then the malware can see the USB device and do everything that it wishes to do on it.
To prevent malware on a given machine from noticing that a USB device is plugged, then, you only have two possibilities:
- Remove the malware from the machine.
- Don't plug the USB device.
From your description, what you are trying to do is analogous to the following: when a hospital is on fire, how do we arrange for the flames not to notice when a new patient enters, so that the flames don't actually incinerate him ? This ridiculous metaphor is meant to illustrate the idea that you might be trying to solve the problem by the wrong end, with predictably suboptimal results.