Killing the good guys was just the best thing that could happen. It doesnt just advances the plot, making Daenerys useful,being the last person with a claim the viewer can root with, but is also in that medieval feeling the story vibes in.
Out of a medieval perspective, they deserved that, and...