Poor planning among a constellation of government agencies and a restive crowd encouraged by President Trump set the stage for the unthinkable.