The game is designed such that the best gear will always be crafted, but crafted gear is better because of the control you have over what's included in the item as much as it is because of the raw stats. More specialized random items are possible but much more rare, to an extent. For example, you'll regularly find, say, 9mm Neo Lugers in shops and carried by NPCs, but you will not so often find LS 9mm Neo Lugers in the same places, and Im not certain you'll ever find LS 9mm Neo Luger XMs; in my experience I cant recall a firearm with 2 attachments appearing in loot or a shop. However, there are some item varieties that seem not to generate randomly at all: smart module guns are one of those, sturdy-vest riot gear/tac vests seem to be another, and unfortunately with electroshock pistols specifically Ive never seen them spawn uncrafted (and because of this I didnt even know they existed for multiple runs).
My guess as to why things are this way is because the components I mentioned are things that werent part of the game in the earliest builds, so integration in random loot was either neglected or purposefully omitted. Regardless, those particular modules are limited to crafting characters in the current patch.