Wait a second! So how about first fixing up what is happening in Afghanistan? If one is to go by your way of reasoning, then all the blame is on Pakistan (which you seem very happy with). Do tell me how the Taliban are getting their funding? Pakistan can barely make ends meet and here people think that Taliban survive because of their Pakistani supporters. All the money going into the Taliban coffers is from the drug trade of Afghanistan. There is no policing! You want Pakistan to block the flow of people well then man the posts on the Afghan side so these folks do not find any gaps during the ingress/egress.
You talk about corruption, contrary to your perception, the same corruption that exists in Pakistan afflicts all of South Asia including India and BD. Despite the same levels of corruption in the past, the level of militancy that is being seen in Pakistan now was nowhere around in the 70s, 80s or the 90s. Corruption was always there...the motivation to become violent was not there. So you are right that no matter how much money is thrown into the problem it wont fix it because there is an inherent underlying problem of occupation in Afghanistan. For as long as that country remains occupied, the militancy, the drug trade, the regional rivalries will continue. Afghanistan needs a break, but the break has to come from all quarters. Do not expect things to be fine only if Pakistan gives up all of her interests and Afghanistan remains under the occupation of outsiders.