SHANGHAI — For three decades, wealthy nations have invested hundreds of billions of dollars in China, helping drive one of the most remarkable economic booms in history.