I think a lot of the long-term bonus of ads is to simply build a moat that other competitors find difficult to surmount.
Many major retailers will require that new brands invest a certain amount of money in advertising product to their region/market before stocking the product. It's also common to 'lease' shelf space to manufacturers.
It was a super niche product they were making but were up against a couple products that I've at least seen ads for online. I think, theoretically, if those other companies didn't have a brand presence then perhaps my friends snacks would have had a slightly better shot at staying on the shelfs. However, from the other products data they may have seen no short-term gain from their ads.
2. People who don't drink soda need to get hooked somehow!
3. Increasing consumption. Think about the "Got Milk?" campaigns of the 90s - they weren't saying "drink XYZ brand milk", they were looking to increase milk consumption.
I think #3 is probably the biggest factor, tbh. That's why you see ads for cotton, milk, beef, avocado, etc.
The same applies to the others you named: sure there are brand, but there is something large below the brand that doesn't care what brand, only that you are eating.
Many people are unaware that a given product exists at all, and others are unaware of all its potential uses; even occasional users can sometimes forget that they liked a product or found it useful.
When I walk into the store there are a very limited number of colas on offer: a can of pepsi, a can of coke, etc.
What exactly is the advert for? My choice has largely been made.