Not always the case. Watch Adam Savage’s video peek INSIDE some USB-C cables from different brands (Apple, third party). There ARE some legit, good third party cable makers: Monoprice, Anker, Cable Matter, some of Amazon Basics (I’ve had 1-2 that failed in a few months). We can’t all x-ray or MRI the cables we buy, so we have to rely on reviews, and … wait for it … known good brands. Including Apple.
Yes this was discussing high quality Thunderbolt cables, but the video looks at lesser data and power-only cables IIRC, too.