You could consider the opening of LN5 as a contrast to her position in LN1 - 4, but I'm using a lens to consider it as more of a continuation of it. It's an emotional regression brought on by loss.
The Rear Palace and the Pleasure District are very much alike. They're bubbles of safety (or, cages) in two dangerous environments, at either end of class extremes.
While Maomao's time in the Rear Palace is practically defined by her solidarity with others (going out of her way to warn about the powder, allowing Fengming to bring her secret to the grave, the ice cream, even the fact she was NOT going to expose Shenlu so the clinic wouldn't close down), she's almost malicious in how hard she brings the hammer down on the people she has power over in the Pleasure District.
It's less like tone-deafness, and more... purposeful. Her intention isn't specifically to hurt Sazen, Zulin's Sister, or Chou-u, but it is to knock them down.
Bullies don't see themselves as bullies, y'know? Parents, teachers, peers, anyone can do it.
For Chou-u, she's annoyed and resentful. She doesn't like kids at this point of her life, doesn't like having one foisted on her, and she doesn't like this loud little shit who doesn't "know his place." She probably sees her behavior as humbling him, or teaching him "hard lessons."
For Zulin's Sister, she's disdainful of being pushed into the same impoverished position as Luomen. She's decided to be rigid about this; a contract is a contract and she wants her damn money, no matter who you are. She even decides she respects the sister's choice to become a courtesan and "survive" the abusive house she comes from-- not seeing herself as part of the equation that is forcing a kid into sex work.
And Sazen, it's like righteousness in her eyes. Their shared history is just leverage she can use to get what she wants; right now, this is a petty thief who sold off a priceless book, and she treats him like scum until Ukyou intervenes. He is the one to suggest that selling off the encyclopedia was probably a matter of life or death, encouraging Maomao to remember that compassion can be helpful for achieving your goals.
(This might actually be where Maomao's character arc about "what is good vs what is legal" begins, thinking about it.)
For all its restrictions, the Rear Palace was actually the first time Maomao had a proper social group. Not just her family, but friends, supervisors, acquaintances. She had to be some amount of friendly towards others, so she made genuine connections that helped her grow.
So it kind of makes sense just HOW hard she snapped back into ruthless apathy after losing her friends, social environment, and palace job all at the same time. AND also thinking Shisui is dead.