Chinese investment on Pak-China Corridor and Gawadar Port has came at a wrong time. Future Chinese presence on the land of Pakistan and its waters is making India feel threatened and encircled - and India is feeling compelled to break the walls around it before they are erected high.
Pakistan is coming out of its wars on western Afghan border and it should've been given more time before Pakistan could bare implications of Chinese presence on the land and waters vis a vis India. Agreements are done with two hands and the other hand was Pakistani - true - but only Pakistan is going to be on the receiving end when threats are mounting from India. China has no option but to compensate for the "timing mistake" it has made. China can either;
- Step Backwards: give up on Gwadar and Economic Corridor plans for a decade
- Step Forward: support Pakistan's defence against upcoming Indian aggression
Chinese economy is slowing down, it needs initiatives and out of borer investments to keep it in shape Pakistan is that opportunity. With that in view, stepping-back won't be a convenient choice. To me, stepping forward is the logical option for China and that would mean undergoing a defence pact with Pakistan.
Just my reading of reality but Allah knows the best.