Amrûnril
Hero
In a world where agnosticism is not an option, i.e.: it is an objective fact of the world that powerful beings exist that are called gods and have significant power to determine how pleasant or unpleasant your afterlife is...
I think the answer is an extremely firm "Yes, they are necessary" if you want people to act in anyway approaching plausible behavior. I will explain:
Some loose premises:
1.) We know that gods exist
2.) There are no "evil" gods who might shelter or protect evil do'ers in the afterlife
3.) We know that "good" gods punish evil do'ers in the afterlife
When you combine these three loose premises together, it would make no sense that anyone would ever actually be evil. It would be like saying "If you do 'x' you will be punished in the most extreme and eternal way possible" Why would anyone choose to do 'x' given the knowledge of premises 1 - 3?
One could argue that a god who will inflict punishments "in the most extreme and eternal way possible" is, in fact, an evil god.
Aside from this definitional question, though, intervention from evil gods is only one of many ways evil doers might hope to get away with their transgressions, especially in settings where deities are not assumed to be omniscient.