The country once saw itself as nearly immune from the world’s problems. But it is now immersed in stand-offs with India and China