...or perhaps there is some after-market thing that fits into the tube-holes that could be useful?
Yes, I'd be more inclined to make something that's custom. I think the actual outer diameter 1/2" emt electrical conduit is just a little smaller than the standard headrest tubes, which I think are 0.75". You can make bends with a manual conduit bender. It would be pretty easy to make a shelf or rack by bending some conduit at an angle that works for you. I'd keep the the length of that shelf relatively shallow to start out. You can always extend it or make longer tubes later.
This should all be just as secure as the original headrest tube. Maybe the frame opening may need a shim. To make up the 0.05" difference in the conduit diameter compared to the original headrest tubes, you can wrap some tape around the conduit in that area or use some shrink wrap tube. I'd do this after painting the whole thing.
I'm afraid you won't be able to get a tight radius loop at the end like the headrest tube without kinking it. You can do a 90 degree bend on each side and cut them off so they meet in the middle, or you can forget about that part and just have 2 parallel tubes cut off at the end. A 3D printed coupler there would be a nice touch to finish the ends and join the tubes. The ends of the tubes are also a good place for some reflectors or LEDs.
I hope the concept is coming through without sketches. The main thing I'm trying to communicate is that it should be fairly easy to do what you would like to do with 1/2" conduit. The material is pretty cheap (even the bender), you can get exactly the length you want, you can experiment with different angles, and there's nothing quite like having a custom functional part on your bike that you made yourself.