The show has spent 8 seasons signaling the ways that war makes monsters out of people and that Daenerys in particular has a deep capacity for cruelty that is only checked when her ego is being sufficiently fed. That Daenerys is motivated by revenge and ego has been seeded from the very beginning of the show.
To be clear, Jorah wasn't entirely wrong to see a "gentle heart" in his queen. There's no reason to believe her opposition to slavery, for instance, is insincere. But loving Daenerys and rooting for her, from the beginning, has meant ignoring the constant reminders that she not only has a strong capacity for cruelty, but that nothing drives her to murder faster than sensing that someone doesn't worship the ground she walks on.
This is the same woman, after all, who was in love with Khal Drogo, a murderous warlord whose life was literally about sacking villages and towns to kidnap people to sell into slavery. And it's in that storyline that we first see that Daenerys expects people to see her as a savior figure and if they express skepticism, she lashes out with a murderous rage of her own.
That would be, of course, the story of Mirri Maz Duur, a Lhazareen priestess whose village is ransacked by the Dothraki and who is about to be raped when Daenerys intercedes, and takes her on as a personal slave. Daenerys clearly believes that Mirri should be grateful to her and Drogo, and so is caught completely flat-footed with Mirri, pretending to offer medical care, does some mojo that leaves Drogo comatose and Daenerys's newborn son dead.
When Daenerys confronts Mirri about this, saying Mirri should be grateful that she "saved" her, Mirri points out that she'd been raped three times, she "saw my god's house burn" and the streets were piled with the corpses of people she knew and loved.
"Tell me again exactly what it was that you saved?" she finished.
In response, Daenerys burns Mirri to death.
In doing so, she creates the magic that allows her to hatch dragon eggs. It's so wondrous that the audience basically forgets that they just saw a woman burned alive for resisting captivity. But now it is clear to see that the ingredient needed to make the magic work, to bring forth dragons, was Daenerys's will to power and cruelty.
Since then, the story lured audiences into rooting for Daenerys by making her mission — to end slavery in Essos — an undeniably admirable one. But the show also portrayed her motivations as less than selfless, including that controversial scene at the end of season three, when Daenerys is held up by a crowd of mostly brown-skinned people chanting "Mhysha" — the Valyrian word for "mother" — while she basked in the adoration and in her white savior complex.
Loving Daenerys as a savior figure required ignoring a whole bunch of signs of her unchecked ego and her cruelty. She gets into repeated conflicts in Qarth and Astapor and Yunkai, often killing her enemies in breathlessly cruel ways, including burning, starving them to death, and crucifixion. She liberates people but then grows bored of the thankless work of governing, abandoning cities she's conquered over and over again.
Many of her vicious executions are easy to forgive, because the people she kills really are jerks, such as the slave masters, the warlocks of Qarth and imperious Dothraki horselords. But sometimes it's a lot harder to stuff the killings down the memory hole, such as with Mirri's murder or the killing of Randall and Dickon Tarly, whose main crime was being skeptical of accepting the rule of a foreign invader.
This is literally the woman who insists on being called "Daenerys of the House Targaryen, the First of Her Name, The Unburnt, Queen of the Andals, the Rhoynar and the First Men, Queen of Meereen, Khaleesi of the Great Grass Sea, Protector of the Realm, Lady Regent of the Seven Kingdoms, Breaker of Chains and Mother of Dragons." The show has not hidden that she has an ego, and there is nothing sudden about this.
The burning of King's Landing, then, is no different than the burning of Mirri in the first season. Daenerys is frustrated that the people of Westeros don't love her and she's explicitly said so repeatedly. She's frustrated that she led the army that defeated the Night King, but that most people don't know or care. She wants the people of Westeros to carry on their shoulders yelling "Mhysha," and since they won't do it, she's furious.
Fans lived in denial for the same reason that the almost exclusively male characters that surround Daenerys — Tyrion, Jorah, Jon — live in denial: She's young and she's pretty and she embraces the nurturing title of "Mother." It's tempting to see her good side and ignore her bad side, and the same fans who are scorning Jon Snow for not seeing it before fell into the same trap that ensnared him.
What's important to remember in all this is that Daenerys's conquest of Westeros is illegitimate. Yes, she happened to land on Dragonstone at a time when Queen Cersei, a tyrant who murders her own people, is in charge, and so it makes it easier to root for Daenerys. And certainly, people who want to oust Cersei — such as Jon and Tyrion and Varys — for their own reasons are happy to back Daenerys because it's politically convenient for them to do so.
But despite all her high-minded rhetoric, Daenerys comes to Westeros as a conqueror and not a liberator.She made the move to invade when she did not because she heard Cersei was bad and she wanted to help, but because that just happens when she had amassed enough resources to make her move. It's easy to imagine an alternate history, where the War of the Five Kings never happened and Daenerys is siding with the Lannisters to wrest power away from King Robert Baratheon and his hand, Ned Stark. In the end, her alliance with the good guys was always just the luck of the draw, and not any testament to her character.
Daenerys is the same person she's been from the beginning of the show, a woman motivated by a desire for revenge and a thwarted sense of entitlement. This is the woman who thrilled to hear Drogo announce he would "take my Khalasar west to where the world ends" to "rape their women, take their children as slaves and bring their broken gods back to Vaes Dothrak."
This is the same woman who swore to the leaders of Qarth that, "when my dragons are grown, we will take back what was stolen from me and destroy those who have wronged me! We will lay waste to armies and burn cities to the ground! "
Daenerys being motivated by a violent desire for vengeance for perceived wrongs against her and a sense of entitlement to the throne is nothing new. Audiences underestimated her cruelty because she's a pretty young woman who has some genuinely decent impulses at times. Instead of lashing out in a Daenerys-like rage, perhaps it's time to ask why it was so easy to ignore all the signs that pointed to this ending.
So, yeah. No destroying of her character arc at all. We saw this coming.