Please, let us not simplify things too much here.
The TTP was pre-planned in certain capitals around the world, just like the ISIS was and still is being supported.
The Pakistan military has been under immense pressure since day one and they have tried their almost best to sail the seas among storms of all kinds, the worst being domestically rooted in corruption due to the utmost incompetence of the politic and bureaucratic class. The police and judiciary didn't make things easier for the rest of the state either.
The Red Mosque operation was an excuse used to the launch the TTP. Things could have been handled differently, for example by surrounding them and essentially starving them. They would have surrendered eventually as soon as the food would have run out. No mullah ever cared more than for his own interests and comforts. The Red Mosque operation was a big mistake and most likely was planned somewhere else. If you look at the geo-political environment at that time, the Pakistani State was being put under immense pressure. The mistake was made and the Pakistani establishment took the bait.
The TLP is nothing but the PMLN. You have remember that the PMLN has been headquartered outside Pakistan for more than a decade now. They have a strong support from certain sectors of this world because the PMLN is essentially an anti-state entity. The fact that the TLP was absolutely silent and didn't utter a word against the PMLN and never directly postured against the PMLN or Nawaz Sharif even after they essentially changed the Sacred Law.
No State ever allows corruption to be involved in dealings with its strongest and longest lasting allies and friends, especially when its survival is at stake. The PMLN did just that. They committed as much corruption they could get away with when it comes to the CPEC. The PMLN is essentially an actively wing pawn for certain powers that be who would like to see Pakistani state in a weakened positon.
Let us not play checkers when the anti-state elements are thinking 10 moves ahead in their game of chess.