Not sure this qualifies as a bug, so I posted this here. This happens when production gets to the maximum quota. All the employees are immediately released to the labor pool for all producers of that item, which I suppose is working as designed. However, the last goods they produced remain in the mine/factory because there are now no employees to deliver it to storage. Often, the quantity remaining isn’t enough to trigger a wagon to move it so consumers of that good are forced to walk sometimes far distances to get it. Even worse, they will often bring back only a few, spending lots of time walking back and forth.
There’s three possible solutions:
First, as others have suggested, have employees in storage buildings who can stock it, and let the mine/factory workers concentrate on production instead of moving stuff.
Second, when the maximum quota is reached, have the employees move the remaining goods to storage before they get released.
Third, have the wagon shops prioritize clearing out the storage of producers that have no working employees, no matter how little there is in there.