Modi has been more effective than Congress ever has in isolating Pakistan.
Even the Americans are starting to turn, and Pakistan is being squeezed by Chinese business interests who see Pakistan as an easily exploitable nation like those in Africa with high interest rates and Chinese labour. Meanwhile, Modi's moves in the GCC nations, at a key time when Pakistan refused military support in Yemen, have done a lot in isolating Pakistan.
By making such an informal visit he is de-legitimizing the Pakistani military government's role in foreign affairs. Not even the ISI knew about this one, and even the Pakistani NSA couldn't make it in time. This itself will drive a wedge between the military/intelligence in Pakistan and the civilian government, whom the military establishment will suspect as operating behind their backs. If the civilian government, rather than the military one, in Pakistan can actually get control of the nation, then things can be a lot different and a lot more easy to handle.