Dont gastric acids disolve the food but without the protection it would burn the stomach and for them to exist we would need something to be protected from. Im just curious.
I think you're asking how gastric acids evolved before the protective stomach lining existed. I'll promote this now, if I got that wrong you can clarify.