That said, I bet you could fake the electron beam position with a high frame rate display, a modified version of this shader, and some kind of calibration routine…
You don't really need to emulate the position of the beam, at least not for the NES light gun. When you pull the trigger, the game first makes the entire screen black for one frame, reading the sensor in the gun and checking that it doesn't detect any light, and on the next frame, a white box is drawn where a duck would be. If the gun does detect light on this frame, it's counted as a hit. That second check is performed while the frame with the white box is still being drawn because CRT phosphors decay fairly quickly. You could, in theory, work around this with an LCD/OLED display with a high enough refresh rate that it would make up for the buffering delays.
Ah dammit I actually knew this, but was thinking about light guns in general. That's a great point, it should actually be super easy to generate a video output compatible with a (S)NES light gun. As penance I'll consider digging one up and adding support to an emulator. :D