China has signed a deal to build 1,000 schools in Iraq as Beijing pushes for a bigger role in the Middle East while the United States retreats.