Actually, IK is probably the only bloody civilian that's managed to do as much to challenge the writ of the state and hegemony of the establishment.
Sure, some cost will eventually be extracted from him, be it self-inflicted even, but it's not hard to envisage the following turn of events:
Government backs off and/or goes home - frankly they have no credibility left anyway, politically, economically, even basic writ of the state is gone
Elections happen and IK wins by a clear majority - polls can be inaccurate, but the margin of lead here is significant enough for it to be comfortable for IK.
PTI majority forms government without any coalition.
A new government and via the President, pending cases begin to become unwound under the discretionary powers of CJP Bandial, he's here till mid-September. The government can also quickly push through bills to grant immunities and legislate against pending cases in courts against IK.
With no pending cases, with the establishment already on the backfoot, opposition in for a prolonged period of roughhousing, IK sets his sights on the GHQ.
Could Hafiz sb become the next Jahangir Karamat? Hard to say, but might not be necessary. The government theoretically has the power to control the ISI, it may be enough for IK to bring back Faiz Hameed out of retirement and remove the current ISI Chief.
A lot of stars need to align, and even then the end (eventual and long-term) may not be pretty, but this sequence of events is a possibility. Even if a few on the list are achieved it's a big win for Imran and a massive relegation of status for the army.
And let's also remember, the establishment's preferred method of dealing with political nuisances in the modern day is to either embolden other politicians to do their dirty work, or to conduct heavy handed and long-term political engineering. The former is currently failing, the latter would be pitted against a decade worth of momentum of their equal and opposite efforts in recent history, and the days of doing coups are over - you have no strategic value to anyone, if you coup, you become a pariah like no other, not to mention the fact that the political cost will be higher than the good old days of narrative control via PTV.