They aren't really rotating as one. Think of it as balanced. A seesaw with two 30kg kids is balanced but that doesn't mean the thing can't pivot. The only way it stays balanced is if the load on each side is equal.
Take a look at the video Tea Jay posted. Notice the part where he attached a single spoke to each wheel (3:45) and where he pushes each with a bar (4:20). What he is illustrating with the bar that can't pivot is a welded seesaw. He shows how holding one wheel will stop the bar. I think that should be easy to see. Because the bar is locked in the center, you can't spin it and both wheels turn at the same speed. This is the welded axle case.
At 4:51 he puts the bar on a pivot. Now it's like the seesaw. If the bar is going to not rotate the loads on either end must be equal. So if the load the bar applies to each side is equal then the torque to each wheel must be equal. Does that clear up the straight line case?
Now when we corner the bar (gear) does spin but it does so at a constant speed. Well let's think of angular acceleration. If the gear spins at a constant speed that means all the forces are balanced. The gear teeth on the left side have to push with equal but opposite force with respect to the right or the gear will not just spin but accelerate. So if it's not accelerating, then the forces must be equal thus the torques are equal. This second explanation is perhaps a bit to brief but I think if you understand the first one it's easier to see this one.