A few weeks ago, Apple's Tim Cook was all smiles as he stepped into a sedan operated by Didi Chuxing. Apple had just invested $1 billion in the ridesharing company, and Cook was no doubt feeling satisfied. But he was probably feeling another emotion, too: relief at getting a piece of China's "internet of vehicles" before it's too late.

That phrase might be new, but the idea isn't. Automakers and tech companies have long dreamed of building internet-connected cars that can entertain passengers, coordinate with other vehicles, navigate themselves and, eventually, drive autonomously. Platforms such as Apple's CarPlay and Google's Android Auto are starting to make the concept a reality.

But China is where the future of this technology will likely be charted. And in trying to compete there, foreign companies are facing a stark choice: Partner up or be left behind.