I don't know how either, though... but what about a hatch/bridge/something that only opens/is passable when a pressure plate right in front of it is pressed? Like...
where ╬ is a 1x1 retracting bridge over a pit (not too deep, mind, just to block pathing). Next to the plates would be a convoluted way forward with high cost to path over, but also the only way in. When the bridge opens up they immediately walk across it and it closes behind them.
A few problems with this:
1) a bridge opens about 100 tics after the plate is pressed, so the dwarf presses the plate and doesn't immediately walk across...
2) retracting bridges on a pressure plate and dwarves.... bad combination... most likely some dwarf is going to stand on the one tile the bridge is, and right at the moment it raises or lowers and get atom-smashed.
3) this could work using hatches/doors linked to plates, those do open immediately after triggering the plate
4) job cancelation due to paths changing, specially when dwarves are hauling something, they step on the plate the path changes the drop the item right there on the plate and move on to another task
5) path recalculation when a dwarf say is hauling something to a stockpile they already have a path if they step on a plate and the path they are following closes, they stop (cancel the job) and spend a while recalculating the new path, this can lead to the plate trigger to change back and more path confusion and job cancels ensue.
I was trying something similar to filter enemies from citizens and allow free passage, but didn't quite work because of the above...
If you want to give it a try a one way corridor can be done by setting up a hatch and a plate linked next to each other, when the dwarf steps on the plate the hatch opens and he can't take the entry-only corridor to exit, do the opposite on the exit-only corridor and they can't enter through the exit-only corridor...