China, the United States’ top global rival, is cultivating an extensive relationship with one of America’s key allies.