There is a way to do it that is simpler than using a relay:
The signal has three terminals, one connected to the red lamp, one to the green, and a common connected to both red and green. Connect the common to the isolated control rail. Connect the green lamp to the other outside rails. Connect the red lamp to the power supply that you will be using, whether the center rail of the track or an accessory voltage. The accessory voltage may be AC or DC, whichever is more convenient, and does not need to be in phase with the track voltage if AC. It should be a suitable voltage for the signal and should share a return with the outside rails of the track.
Finally, connect another incandescent lamp or lamps, with the same voltage rating as the signal, in parallel with the red signal lamp, that is, between the signal power supply and the control rail. This lamp or these lamps should be selected to draw somewhat more current than the red signal lamp. You can hide them under the layout; or you can use the lights of some other lighted accessory. For example, you could have a 395 floodlight tower somewhere on the layout, perhaps far from the signal, that will light up when the signal switches to red.
It works this way: When the train is not present, the red and green signal lamps are in series and powered by the signal supply voltage source. However, the red does not light noticeably because the other lamps in parallel with it reduce its voltage to almost nothing. Most of the voltage goes to the green lamp, which lights brightly. When the train comes along, it shorts out the green lamp, which is connected between the control rail and the outside rail, and applies the full voltage to the red signal lamp as well as to the other lamps in parallel with it, lighting them brightly.
I've put some numbers to it. When you use a single extra lamp of the same kind as in the signal, the green lamp should be about 82 times brighter than the red lamp when the train is absent. It's actually a little worse, because the color of the red lamp's filament shifts toward the red when it is that dim; and a red filament is easier to see inside a red lamp. When you use two additional lamps of the same type, the green lamp is about 1087 times brighter, again not considering the effect of the filament color. That should be more than enough contrast between off and on.