You have heard, "See the whole play," right? This is one of those cases. The defender is penalized for the entirety of his actions, not just the first infraction committed.
Counterexample: If defender B1 swings with his left hand in an attempt to block a shot, but commits a goaltending violation. We all know that the ball becomes dead at this point. However, while still in the air, he follows this by swinging his right hand in frustration and intentionally slaps the backboard. This action is clearly worthy of a technical foul. Can we agree that most quality officials are going to call both the violation and the technical foul?