Two other everyday situations follow the exact same pattern as a recoiling gun.
A rocket in space pushes hot exhaust gas out of its engine in one direction, and that push on the gas is met by an equal push of the gas on the rocket in the opposite direction, propelling the rocket forward with nothing external to push against.
A swimmer pushes water backward with their hands and feet, and the water pushes the swimmer's body forward with the same force. In both cases, as with the gun and bullet, one part of the system is pushed one way while pushing the other part the opposite way, with equal magnitude.
This mutual, equal-and-opposite push between two interacting bodies is the hallmark of: \[ \boxed{\text{Newton's third law of motion}} \]