I see a lot of references to "bring along a yogurt, cheese, chorizo, milk", etc in your pack." Buy the night before for breakfast" and the like, which I can see for a couple of hours but not buying and storing for 24 hours or more.
In the US, all of those items require refrigeration for food safety. Is there different shelf stable packaging in Spain or do we store things differently in the US than the rest of the world?
Traditionally prepared sausages are anyway purposed for easy storage, often not requiring even a cold room, as are some other cured meats. Little 1€ packs of sliced sausage OTOH cannot really be transported for more than a few hours.
Pickled foods ditto, as well as the more traditional foodstuffs in glass jars, like jams & marmalades just for starters.
There are
some hard dry cheeses that are fine in a backpack, especially in the cooler seasons of the year. Emmental/Gruyère is borderline, but I've found it keeps for a couple of days or so. A proper hard cheese should OTOH be fine until you've eaten the last chunk of it. And the typical Pyrenean & Spanish semi-hard cheeses keep really well, as part of why they are made in the first place is for people like shepherds who might be out of the house for days on end. Those little packets of cheese slices are fine to carry for a lunch break later in the day.
Some fruits and veg that can be eaten raw are best if they've never been refrigerated, but sadly, that circumstance can sometimes be hard to come across even in old Europe. A carrot producer once gave me a half kilo packet of carrots that lasted me four weeks on my 2005
Camino !!
I would never carry milk on a hike, or yoghurt though the latter is at least conceivable, especially a proper & traditionally made one (also, increasingly hard to find).
Buying in the evening to have at breakfast is perfectly OK, as your backpack is a dark place, and overnight it will also be a cool one.
Otherwise yes, I think you do store things somewhat differently in the US than the rest of the world !!