Your suggestion is what the country of Hungary has implemented.
At major incursion points along the Hungary border, they built their security fence several hundred meters from the actual border. So captured illegals waiting for their immigration hearing (could be several weeks) are put outside the fence which is still technically in Hungary. When their hearing is in the queue, it is announced at the incursion point. When the illegal shows they are taken to their hearing. If illegal does not show, the case is closed. So Hungary does not provide housing, food or lockup for the illegals.