BEIJING — As the North Korean leader, Kim Jong-un, prepares for his meetings with the presidents of South Korea and the United States, China has found itself in an unaccustomed place: watching from the sidelines.

Worse, many Chinese analysts say, North Korea could pursue a grand bargain designed not only to bring the isolated nation closer to its two former Korean War foes, but also diminish its reliance on China for trade and security.

Such an outcome — a reversal of 70 years of history — remains a long shot, amid doubts about whether the North would agree to relinquish its arsenal of nuclear weapons. Still, China finds itself removed from the center of the rapidly unfolding diplomacy, and unusually wary about Mr. Kim’s objectives in reaching out to his nation’s two bitterest enemies.

Mr. Kim’s meeting with the South Korean president, Moon Jae-in, is set for Friday, and a meeting with President Trump — the first ever between leaders of the two nations — is expected to follow in May or early June. In a sign of just how much is suddenly on the table, South Korea recently confirmed that it was in talks with the North and with the United States about signing a treaty to end the Korean War, which halted in 1953, but never formally ended.