Is my solution to prevent leakage between power rails correct?
That isn’t going to work. Each board will detect its own Vdd, regardless of the other being plugged in. You’ll need two pins, one for each board to detect the other. I’d suggest putting a pull-up resistor on the defection side and connect the opposite side to ground. The detect pin will be high until the other board is attached, then will go low.