Him pardoning the rioters is a nightmare scenario, both politically and for the long term survival of the republic. But the only real solution for this is impeachment and conviction, as generally the pardon power is not subject to judicial review.
It can make it impossible to prosecute, because the President is the Chief Executive and ultimately the authority to which all federal law enforcement answers.
(1) Honest, even if mistaken, belief that action is taken in cooperation with the government defeats the mental state requirement for most crimes.
(2) The doctrine of “entrapment by estoppel” bars criminal conviction where a defendant reasonably relied on misrepresentation of law by an official in undertaking action that is prohibited.
(3) The more common doctrine of entrapment bars criminal conviction where a defendant was induced by a government agent to commit a crime and was not otherwise inclined to commit the crime.