Your schematic looks correct. But if thinking of a new PCB, best to confirm there is any interest from anyone who might actually build it! As I see it, the application is for those guys that want to use AC Accessory Voltage from an existing train transformer to fire relays triggered by insulated-rail sections. In other words it would be inconvenient or impractical to add a wall-powered DC-output power supply. I just don't know how many guys are in this situation. That is, low-voltage DC power supplies for driving accessories can be had for pennies per Watt as documented in dozens of OGR threads. OTOH low-voltage AC power for driving accessories runs about 50 cents to $1 per Watt...and for virtually all train transformers any Accessory AC power takes away available motive power to drive trains.
In any case, sticking with DC power derived from an existing Accessory AC, I'm imagining something like this:
So in words, ACCessory voltage (e.g., 14-16V AC) would power an AC-to-DC power regulator module (~$3 on eBay, free shipping from Asia). The regulator would be set to 12V DC output. The 12V DC would power a multi-channel (1, 2, 4, 8, etc.) relay module (~$1/relay, free shipping from Asia). The "mythical" optoisolator/optocoupler module would allow the AC insulated-rail sections (i.e., AC ground on the outer rail) to trigger the DC relays.
Let's just say this is the matter at hand.
I agree that a $2 all-in cost target is a pipe dream. To that end, for the determined DIY'er perhaps the closest exit is to simply buy the $2 DC-to-DC optocoupler module on eBay and extract the DC-input PC817 optocouplers. Then insert AC-input optocouplers as the pinout of the two types are the same. The PS2505-1 is ~25 cents a piece on eBay (free shipping from Asia).
If someone is considering doing this, I'd suggest adding a capacitor across the output to demote relay chatter from intermittent axle contact. Also, depending on what DC output you're driving note that the AC-input optocoupler actually generates a pulsed-DC output or what amounts to 120 pulses per second which can bother some circuits - a capacitor smooths the ripple.
OTOH, if someone wants to undertake a new PCB design using DipTrace or whatever.
1) I'd place the 4 optocouplers in a DIP-16 footprint. You should be able to "stack" four DIP-4 packages into a DIP-16 footprint. This way you can install a 4-channel DIP-16 component...or 4 separate 1-channel DIP-4 components using the same board. Heck, you could even mix and match so 2 channels are DC input and 2 channels are AC input.
2) I'd lose that 2-pin programming jumper that ties the input ground to the output ground on each channel...and use the space to provision for a capacitor to demote relay chatter or buzzing.
But to repeat, I'd be curious to hear real-world applications! I do recall a recent thread about someone trying to implement a fault detector for 4 AC brick power supplies. That is, if any of the bricks tripped its internal breaker, then this was to trigger a global action like killing power to all tracks. As I recall, my suggestion was to use a 4-channel AC optocoupler to monitor each AC brick voltage. The optocoupler outputs would be wired into the logical "AND" configuration so if any input dropped out, a DC relay with high power contacts would also open and kill power. But this was a one-off and presumably simpler to solder the handful of components rather than fabricate a custom PCB.