The Gate Control Theory of Pain, proposed by Melzack and Wall in 1965, posits the spinal cord has these so-called “gates” (actually inhibitory interneurons in the dorsal horn). When fast fibers (A-beta) are active, they close the gate to slower pain signals from C fibers.
So, rubbing, cooling, or heating the skin after pain actually has a neurological basis, not just a placebo effect.