Interesting, most of the counterfeits that affect me (eg. FTDI, STM32 clones) have been just straight up clones developed from scratch, not excess inventory / ghost shifts / packaged rejects. I guess it might be a digital/mixed-signal split, with the two worlds having different issues?
(also interestingly the STM32 clones I've seen had stacked die flash because they didn't fab them in a technology that could also do flash, so you can easily tell the counterfeit from sanding down the package and looking for an extra set of bonding wires; it's also a cool place to access the internal flash bus if you wanna bypass some readout protection :) )
I remember the mess with FTDI clones back when I was still a hobbyist and buying stuff from eBay, but ever since I’ve started doing EE professionally I rarely run into anything that bad. You’re not going to make a clone Marvell processor for example, but I’ve run into several ghost shift runs from a distributor.
I don’t usually buy from electronics markets in Shenzhen either so that probably helps.
Buy in bulk from the Shenzhen markets and sellers will be pretty clear that you're getting a clone, and will give you samples of that specific clone so you can QA your product with them. (Some popular devices have multiple clone suppliers).
I now always buy clones where possible - whilst not all features are implemented and some specifications won't be met, the devices seem to match the original for reliability, and sometimes even come with their own cloned modded datasheet.
(also interestingly the STM32 clones I've seen had stacked die flash because they didn't fab them in a technology that could also do flash, so you can easily tell the counterfeit from sanding down the package and looking for an extra set of bonding wires; it's also a cool place to access the internal flash bus if you wanna bypass some readout protection :) )