So we're going to ensure the Lannister army has surrendered by torching the civilians nowhere near the Lannister army. Brilliant plan by a sane leader.
If there was 1 brilliant plan in the 8 seasons we never go 8 seasons.
What was the option - just lay siege and wait for all the people inside to die miserable starvation and disease deaths and THEN have Cersei torch the entire city with dragon fire?
In the end, Cersei is Dany and Dany is Cersei. Both want power and try to secure and keep it with reckless abandon.