Foreign investors are shunning Chinese stocks and bonds as Beijing’s economic headache builds