That internal latency of OBS itself is normal, especially when accounting for h264 (which always operates about 20 frames behind), audio latency, and buffered video frames on the GPU. It's not a bug -- OBS has to have latency to be able to do any sort of processing; rendering, capturing, and especially encoding and audio processing. OBS having approximately 1 second latency between the captured video data and the output video data is completely normal and expected.
I might not be fully understanding what you're doing here -- if I'm reading correctly you're outputting metadata along with the video frames associated with that flash or something. The data in the portion of code you're modifying is always going to have a delay (or rather latency) because it's in the encoding/output pipeline, not the rendering pipeline. You will have to store a system timestamp of your event (with os_gettime_ns right as the event happens) and then compare that time to the time of the video frame (encoder_packet::sys_dts_usec * 1000), and then wait until you have the frame closest to that timestamp, and then output your metadata for that event. Or store it in the frame data as metadata pretty much right as it's rendered and have that metadata go through the whole graph, which would probably be more difficult.
Don't try to fight against it -- instead, work with it because it's completely normal. Just store a list of your events and wait for the frames to catch up to those events, and then output your metadata. Fighting against buffers will only cause pain. You will never get 10ms latency out of something like OBS, because there has to be buffering of things from capture to output. A single 60FPS frame is 16.6 milliseconds -- one frame of buffering alone will shatter that desire by itself, so trying to fight against the internal latency of the subsystems is completely futile.