Hunting and gathering seems like something that would make sense to, well, hunter and gatherers. But how did people come to realize that the seeds from a dry grass could be ground into a powder, mixed with water or oil, and be baked into something edible? It doesn't seem very intuitive, but if early peoples didn't know about making bread then why cultivate grains?
As you say, it wouldn’t make much sense to first domesticate cereals and then discover how to eat them, in the form of bread or otherwise. Fortunately, this is not how it happened. Humans were eating cereals and making “bread” long before we ever domesticated any cereal.
Cereal domestication began with barley, emmer and einkorn wheat in the middle east, around 10,000 years ago. But humans were gathering grains from the wild forms of these plants long before that. For example, we have 23,000 year old archaeological remains at the Ohalo II site in Israel, showing that humans were processing cereals (barley and wheat) by pounding them with stones to produce flour, and baking some kind of bread in an oven-like hearth.
Grains are extremely rich sources of protein, and dense packed seeds from grasses like barley or early wheat were important to our hunting/gathering ancestors. Long before domestication, they were gathering cereals and other plant products. It’s true that cereals are kind of hard and tough to eat without processing and cooking, but fortunately, these things also have a long history predating domestication.
For example, we have evidence of extensive plant food processing at various sites in Italy, Russia and the Czech Republic, dating from 30,000 years or even earlier. At these sites, humans were gathering tough plant materials including roots, rhizomes, and even some seeds, and were then grinding and cooking them to make them easier to eat and to increase their caloric value.
In fact, processing and cooking plant foods isn’t just restricted to our species, we have evidence of Neanderthals at Shanidar Cave in Iran and Spy Cave in Belgium cooking several plant foods, including seeds:
So the likely scenario is that very long ago before domestication and agriculture, our ancestors gathered plant foods, including foods that are good sources of nutrients but are too tough to chew. These foods were then processed, mostly by pounding to create a paste if wet, or a flour if dry, and were then cooked before eating.
A very simple way to cook flour is to mix it with a bit of water and spread the paste on a stone which you put by the fire. This produces a simple flatbread, which is the earliest form of bread. Ovens produce a more even heating compared to an open fire, and we have evidence of oven-like enclosures associated with hearths by at least 20,000 years ago.
Leavening bread so that it will rise is a much later invention, and did not become routine practice until after agriculture, probably around 6,000 - 7,000 years ago.