Warred and swallowed food sticks in a dense lump, and gastric juice only affects its outer layers, making them softer and slurry. When waves of muscle contractions pass along the stomach, they move the thinned layer to the exit of the stomach. Thus, the digested part of the food enters the intestines, and the undigested becomes open to gastric juice.
If components resistant to gastric juice were in the outer layer of the lump, then they do not move until they become a slurry. In addition, if the duodenum does not have time to process the incoming mass and overflowing, then the exit from the stomach is reflexively locked.