Memory is different because it's largely not a consumer market, but instead an input to other products and those products are not sold to consumers but to enterprise customers. I'm guessing there are plenty of domestic enterprise customers to buy the memory produced.
Something China literally never did though? They seem to love flooding the world with what they produce.