@Wallenstein I think maybe component tags can be used to solve this problem. There could be some tag, like “no_snap” for example, which will disable the snap for the component. The plugin could check those tags and, if the tag is here, ignore the component and all its sockets.
So in your case, your BPs X and Y will have static mesh component B with the component tag “no_snap”, therefore the plugin will ignore it. But if you use B alone, like a static mesh actor, or inside another BP, without tags, then it will snap.
Would that work for you? At first sight that should be easy to implement I think.