The long-winded explanation of what's happening
The tach signal wire (white/slate) sprawls out around the relay compartments, ecu compartment, and up to the dashboard. If a small voltage spike gets on the tach wire, the RPM relay will run briefly. When wires run parallel to each other, it's easy for a wire carrying high voltage to induce current into the surrounding wires.
Spikes like this are typically caused by a coil of wire. Relays would be the prime suspect if they have defective or missing "flyback" diodes, which suppress the voltage spike. If wire is actually physically in the shape of a coil, that could sometimes be enough.
The ignition ECU turns voltage on and off to the ignition coil. Voltage on = charge primary coil, voltage off = field collapse into the secondary windings, creating high-voltage spark, but also a small reverse-current high-voltage spike back into the coil primary wires (one to 12v, one to the RPM signal white/slate wire). The RPM relay detects this spike created by the ignition coil and briefly turns the fuel pump on as these spark events are detected. The dashboard tachometer detects this spike and registers the engine RPM. The idle system also uses this to control idle speed.
When you turn on the headlights, the corresponding relays are energized. When you turn them off, the magnetic field that was holding the relay open collapses which creates a spike. A functioning flyback diode prevents the spike from leaving the coils, but if it's missing that spike will travel back down the wire and possibly affect anything nearby in the harness.
A EFI car can use a relay that has the armature and flyback diode removed. 5v goes in to the coil wire, and when switched off, the subsequent voltage spike drives the tachometer. This lets you directly drive the tachometer without tying it into the actual ignition system.
There are lots and lots of coils in our cars that can create this kind of noise: Ignition coil, all relays, AC compressor coil, ignition vacuum solenoid. Probably lots more that I'm forgetting. The noise suppression caps really do quite a bit more than just clean up AM radio reception.