The Army creates the excuses and justification for it to grab power. It meddles in politics and ensures that only pygmy politicians rule the stage. If it keeps to its legal duties, the political process will improve by itself.
Please read the oath Army officers take. There is no "when it deserves it" clause:
"
(In the name of Allah, the most Beneficent, the most Merciful.)
I, ____________, do solemnly swear that I will bear true faith and allegiance to Pakistan and uphold the Constitution of the Islamic Republic of Pakistan which embodies the will of the people, that I will not engage myself in any political activities whatsoever and that I will honestly and faithfully serve Pakistan in the Pakistan Army (or Navy or Air Force) as required by and under the law.
May Allah Almighty help and guide me (A'meen)."