Indeed. As plenty have said, this was foreshadowed. However, just as with Arya and the whole "blue eyes" business in episode 3, "it was foreshadowed" does not mean "therefore it's good writing". The plunge from "ruthless and driven, but held back by principles" into "genocidal maniac" is too sudden, and too severe.
Had Dany decided to torch the Red Keep, uncaring for the civilians Cercei packed there, I wouldn't have had an issue with it. It would be a terrible and very ruthless act, but justified by her previous failures and losses going to her head and making her favor a more direct approach. It would also be more interesting and morally ambiguous in a Tywin-esque, ends-justify-the-means way.
Going out of her way to slaughter every single commoner in sight before gunning for the ones who actually wronged her after achieving victory is several steps too far, however, and removes any single possible moral ambiguity from the scene. Dany is a monster now, and there's no reason not to kill her.