Just for clarity purposes I think I will further explain the bending moment I am talking about, because moments can exist on multiple axes (often at the same time) and they have different common names as well. That can lead to confusion.
Imagine that your socket is welded to the bolt head. Now imagine that your ratchet extension is made out of thin round spring steel instead of thick steel, so it can bend/flex lengthwise when force is applied. When you apply hand force to the ratchet handle (without supporting the ratchet head) the ratchet will be transferring torque to try and turn the bolt head, but it will also be trying to bend your extension lengthwise. This bending force is not the same torque force that is trying to turn the bolt, it is a secondary bending moment (created by your ratchet and extension geometry). The secondary bending moment is what tries to tilt the socket off of the bolt head if they aren't welded together. The magnitude of the secondary bending moment will depend on the extension length, ratchet handle length, hand force applied to the ratchet handle, etc. When you naturally push with your other hand on the ratchet head to keep the socket square on the bolt head, you are physically counteracting that secondary bending moment your main ratchet hand is creating. That secondary hand force applied to the ratchet head will naturally straighten your flexible socket extension back out if it is being applied in the correct direction. When that flexible extension remains straight (because of the secondary support you are providing at the ratchet head), the only net force the bolt head sees is torque trying to turn the bolt. As a result, the bolt head will turn without the socket wanting to tilt off of the bolt head in the process.