But China feels it needs North Korea as a security buffer.
An under-developed and impotent North separates China from a vibrant and democratic zone now called South Korea. For the moment, that’s just fine. China is a soft-authoritarian regime; a main worry is control of its own people. But any scenario that ends up with the US and allies standing on its northeast border becomes a problem in China's eyes. The idea of a US soldier driving a jeep or tank to within inches of its territory, or of Japanese or South Korean traders standing freely at the Yellow River, is radically unwanted. East Asia is still in a 19th century “power game” of nations.
Hence, in Beijing's view, keeping North Korea stable keeps it as a buffer from the US or anyone else getting too close to China.