The nations were punished for the crime of rejecting the Prophet itself and rejecting his call to monotheism. The other evil deeds were an addition to that, since the Prophet came to warn them against those deeds as well.
But, those other deeds were not necessarily needed. Rejecting the Prophet and Shirk was enough and was sufficient reason to punish.
Firstly because Allah says this very clearly in the Quran:
And We certainly sent into every nation a messenger, [saying], "Worship Allah and avoid Taghut (false gods)." And among them were those whom Allah guided, and among them were those upon whom error was [deservedly] decreed. So proceed through the earth and observe how was the end of the deniers. (16:36)
The crime Allah charges the people who were destroyed of is being "deniers" of the Prophets bringing Tawheed.
Secondly because Shirk is the worst crime possible. It makes no sense for there to be a requirement of a lesser crime to punish them. Allah says in the Quran:
Indeed, Allah does not forgive association with Him, but He forgives what is less than that for whom He wills. And he who associates others with Allah has certainly gone far astray. (4:116)
Thirdly because there are a few nations for whom Allah mentions specific crimes other than Shirk (like the people of Shoaib AS and the people of Lut AS). However, most other nations don't have any other crime mentioned for them (like the people of Nuh AS, the people of Thamud, the people of Aad, etc.).
Hence, it is clear that the other crimes were only additional rather than integral. If other crimes were necessary, Allah would have made clear the other crimes of all nations that were punished.
Regarding innocent people, Allah saved the followers of the Prophets. Many of the prophets had a few followers in their nations, so those followers along with the Prophet were saved. And Allah would not punish people if there are sincere repentant people in them:
But Allah would not punish them while you, [O Muhammad], are among them, and Allah would not punish them while they seek forgiveness. (8:33)
Hence, only people who rejected the Prophet were punished, and only after the good people were brought to safety.