By investing billions of dollars in Pakistan and dozens of other countries, China is gaining cultural cachet worldwide.