Beijing is trying to cement China's role as a leader of a globalized world, just as the U.S. appears to be pulling back.