China is still an "emerging power", we still need many more years before we are ready for the big time.
Pakistan's best bet right now, is to join the SCO and focus more on things like Gwadar port and KKH. When Pakistan becomes a vital lifeline to China's economy, that will ensure a de-facto defence alliance, even without it being properly formalized.
For a true defence pact, it will have to wait until China has properly emerged as a global power.
What is taking so long for SCO in accepting Pakistan?