These kingdoms which helped Afghans were Hindustani/Indian , they were very much Indian , the reason we call them Indians is because they were Indianized in their culture and lived east of Indus in the land called India even before the British arrived. How India became a nation state and what was the role of the British has been discussed to death in this very forum and i'm not going to fall for the flame-bait.
The reason Ranjeet Singh captured large parts of Afghanistan (of what is today Pakistan) is because he had a chivalrous General in form of Hari Singh Nalwa, ofcourse he had muslims in his army just as the Marathas had them when they fought the battle at Panipat but to say that muslims punjabis were the reason for his victories is something a person with the intellectual level of Shan can emulate, i hope you are not him
Whatever Pashtun lands Pakistan has today is due to Ranjit Singh, so you should thank Ranjit Singh for giving you half of Afghanistan .