Its not a plot hole, Anakin didn't kill any innocents in EP 2 he killed Sand People who are hostile to pretty much everyone and they kidnapped and tortured his mother to death.
Genocide is never acceptable. Anakin killed them all. He didn't cut a swathe to his mother, he brutally killed those involved, and murdered those uninvolved. He not only killed the guilty, but the innocent as well.
It'd be like if your mother was kidnapped and tortured, and you killed the killer, his accomplices, the killer's family, the accomplices' families, and all their friends, and everyone their friends knew. At some point, your murders outweigh their crimes.