America’s postwar allies are weighing closer ties to Beijing as they scour the globe for alternative markets.