you underestimate Daenerys. she didn't go suddenly mad. think about it. everyone she's ever trusted or loved has either died, failed, or betrayed her. including Jon, when he told Sansa who he was. she's aware that varys spread the word and how could she not know that Westeros will side with Jon rather than her? he's going to be pushed into being king, whether he wants to or not. her kiss was one last test, and he failed it. she risked her armies, losing half of them, her dragons, 2 of which died, and her dearest friends, who also died, to save winterfell and the north and all of the kingdoms and in return, she is shunned and still regarded as the enemy. her days were numbered - she'd targayrean. she'd be neutralized one way or another, and she knew it.
no, she did not go mad. the burning of king's landing was a demonstration of what she was capable of. she, singly handedly, destroyed the most powerful city in the west. it wasn't madness. it was a declaration. i will not go quietly. either accept me as your queen or i will destroy you.