What started as ordinary tech sales to China became the foundation of a sweeping surveillance machine, powered by U.S. companies.