I think that it's significant that the riots were mostly incited by a sitting President's use of Twitter to cast doubt on the legitimacy of the elections, and that several key members of his party followed suit because preventing a Biden win was more important than reinforcing the rule of law.
Al Gore had a significantly better case to drag out the results of the 2000 election, but he conceded because moving on was best for the country (Note: this is not an endorsement or indictment of one political party over another, but individual leadership).
What do you think could have been done differently to prevent these events from happening?
To my knowledge, the members of the republican party that spoke out were mostly just advocating for recounts. Ted Cruz caught a LOT of heat in the media but his speech on the floor amounted to "let's recount everything and re-establish people's faith in the system." He wasn't casting any doubt that I know of but rather trying to cast reassurance.
For one, Democrats filing lawsuits to prevent audits and recounts was immature and caused much of the skepticism. The addage of "what have you got to hide" comes to mind. Furthermore, I think videos of people passing USB sticks to each other and pulling boxes out from under sheets should've been investigated because those were going around like wildfire online. Rhetoric from both sides is what caused it to happen but that should be unsurprising given the kind of hyperbolic rhetoric we saw for the entire Trump presidency about every single issue from "he's a Russian agent" bullshit to "peaceful protests."
Off topic, but if anything we've got way more cause to believe in Biden and his son being corrupt Russian and Chinese agents than we ever saw of Trump.