Modern China's geopolitics are the opposite of what Pakistan was taught by its western masters, which is kinetic war, propaganda, espionage, backstabbing, proxies, economic warfare. The Chinese are also wary of walking straight into the trap being set up for them, eg invade Taiwan or get involved in a decades long war in your neighboring country. The Chinese do not play the game others want them to play, which severely frustrates the West.
China has given Pakistan a chance to transform itself vis CPEC and is giving Taliban in Afghanistan same chance, but both countries are misunderstanding what the Chinese want. Part of this is on the Chinese who are not explaining how they transformed their country over the last 40 years, their vision of Belt and Road and what they now expect of Afghanistan and Pakistan. But if this Afghan-Pakistan conflict keeps up, it's quite possible China may simply wash its hands off both countries and wait for more intelligent leadership in the distant future.