I don't think there were designs on Afghanistan, but these strategies usually work like chess, where having an opposing piece in one place constrains actions in another. Afghanistan is next to Xinjiang, where some subversive actions were demonstrated, so China ended up having to pay a lot of attention to the western front and therefore had less strategic flexibility in the near Pacific where her main interests lie.
Having said that, it didn't work at all. China patiently used those 20 years to develop its economy and infrastructure, locked down Xinjiang against subversion, set up Belt and Road, and gained strategic tempo in the South China Sea and the Taiwan Strait while the US got much too carried away in Central Asia.