Any ideas?
Here's what I'd start with, and experiment to get it tuned.
Have two paths to the stockpile. You're making a one-way pathway. You'll have a normal pathway that dwarves will normally go in and out of. Just before a cart reaches the stop, it hits a pressure plate which triggers a number of things:
1) It opens a hatch over a pit two tiles from the stockpile along the normal hallway. One tile from the stockpile put another pit with a retracting bridge that is also hooked to the same pressure plate. Anyone going to the stockpile in the next 100 ticks will be blocked and turned away by the open hatch. Anyone going to the stockpile in the 100 ticks after that, after the hatch has closed will hit the open bridge and be turned away. Anyone falling in eihter pit will have a stairway back up to the hallway on the safe side from the stockpile. This keeps anyone from approaching the stockpile for 200 ticks.
2) Anyone on the stockpile is now trapped. Put a door on the other side of the stockpile that leads to a hallway back to the other side of the pit that's at least 20 tiles long. This is a one-way door. The door is normally closed and so nobody will path down those 15 tiles until a cart is arriving. Anyone on the stockpile won't be able to path over the pit but will be able to path through the door. 100 ticks should be plenty of time for them to pick put their stuff and acquire the new path. Anyone pathing back up the one-way hallway won't have time to reach the door in the 100 ticks before it closes. So, this lets people out, but nobody in.
3) Replace the hatch under the quantum stockpile with a retracting bridge. It has a 100 tick delay, allowing anyone underneath time to pick up their stuff and walk out through the door. Nobody can arrive in the next 200 ticks, so you have a buffer of time for the cart to get from the pressure plate to the stop, to dump, to open the bridge, for the stuff to fall, and for everything to reset.
I also have a design for a latched trigger that might be useful in a setup like this, though how is escaping me:
>P=<
*-**
>< rollers pushing east/west
P pressure plate
= track
* gears
- axle
Use two carts on the track. When pushed to the west, one cart sits on the plate and holds it down. When the west gear assembly is activated, it pushes both carts east and off the plate. Depending on how you are resetting the cart after a dump, you could use the carts arrival to seal off the path to the stockpile and the carts departure to open it up.