The countries’ strategic pact gives China a western gateway to Middle East markets, and has saved Iran from international isolation and economic ruin.