The insurrection was not the coup itself. It was staged as the coup was failing. The insurrection and the coup were distinct, but the insurrection emerged from the coup. It has been a common conceptual error to consider the insurrection alone to be the coup.
The coup, however, was an elaborate plot developed over months to claim that the votes in the key swing states were fraudulent, for Mike Pence as the presiding officer of the joint session of the Congress to declare on that basis that the certification of the presidential election on the constitutionally mandated date could not be done, to force that day to pass into a twilight zone of irresolution, for House Republicans to hold the floor brandishing the endless claims of fraud, to move the decision to the safe harbor of the House of Representatives, voting by states, with a majority of 26 controlled by the Republican party, to deny both the popular vote and the electoral college vote to retain Trump in office, for protests to breakout at federal buildings, and for the president to invoke the Insurrection Act to impose law and order.