You just described Pakistan's Foreign policy
It is India money that is helping Pakistan economy, not Pakistan money to India's economy. The money you spend on Chinese goods go to the economy of China which in return provides funding for the economy of Pakistan including the defense projects. It is basic economy 101. Math is supposed to be your strong suit.