Actually what you are stating is Kantian morality.It is just one of the branch of moral philosophy. Any act could be justified on basis of utilitarian principles as long as you could find a major benefit in that act.
When individuals are judged, you have various tools to judge morality of an act. But in case of groups, utilitarianism is best tool.
If we look at it in a cold, calm, and calculated manner; Riot did had strong justifications.
Godhra train burning was an unprovoked act of collective violence by Muslims. If not avenged in one manner or another, it would have set up a dangerous precedence and would has lead to repetition of these incidents in future. Terrorists are a very small problem in front of incessant bullying and political muscle flexing that would have been done by muslims, had they not been put in their proverbial place.
The only good that could have stopped this was if Justice was done by state in form of quick prosecution of perpetrators, which in context of India is .........meh.....