PCB edge connectors for either board to board and screw terminal
I don't think that it exists a common connector for both solutions. When inserting a device into a rack, the pin size and diameter must match the female socket very exactly.
When you attach wires, you can't use the same technique because the wires can have different diameters and qualities, and will be usually smaller than pins. That's why with wires you need screws or springs.
You could use this type of connector which is designed for wires. Then adapting the rack terminal PCB with right angle pin connectors, spaced at 4mm pitch so that they can enter the wire connectors. But you would need find such pins long enough to enter the connector deeply enough. And it would be quiet experimental.
Board to board manufacturers may offer you ready solutions if you buy some quantities.
https://www.we-online.com/catalog/en/em/connectors/led_connectors/wr-leco_wire_to_board/
IMO it's more simple to duplicate the connectors: One for the rack, the other for the wires. It will be more reliable and cheaper than a customized solution. For only two pins, it's no big deal.