As 2016 nears an end, five of the seven most valuable companies in the world are tech companies. That helps explain why this year was a difficult year for these companies, which faced criticism and scrutiny while clashing with governments, writes Christopher Mims.