Summary: we do have evolutionary very old taste receptors that detect proteins, and we probably have rather well regulated protein intake. Knowing that this is protein is not necessary to achieve this.
OTOH, while grains + pulses are good protein sources, of course meat, fish, eggs and later on milk are even better sources of protein (higher protein content wrt. dry matter).
given their lack of knowledge about biochemistry,
They may not have had our knowledge about biochemistry, but they did have the biochemistry:
how did these societies learn about the advantage of pulses' protein contents
Humans have the so-called umami taste receptor which senses amino acids/protein.
and the importance of balanced carbohydrate-protein diet?
That's where the sweet taste receptor comes in, which detects digestible carbohydrates: the amylase enzyme in our saliva splits monosaccharides [sugars] off the starch (carbohydrate). It's closely related to the umami taste receptor. Bitter receptors are also related (and are in fact a whole family of receptors detecting a wide variety of substances).
Incidentally, sweet and umami are two basic tastes that are unambiguously pleasant. That is, they just had to follow their palates, the link protein - advantage is hard-wired in humans.
Salt is pleasant or unpleasant depending on sodium deficiency, bitter unambiguously bad [but we can learn to accept it in order to have other benefits - think coffeine], and sour becomes acceptable only if offset with sufficient sweet; I'm not up to date about fatty acid taste receptor research, but AFAIK, some receptors have been identified.
As for the balance of the diet, in a way that probably didn't matter as much back then as for us Westerners now: until lately most humans experienced hunger and starvation every so often. So the question of balancing a choice between overabundant food types and limiting your food intake was a non-question.
Plus, humans like food diversity, even if they get food that is nutritionally balanced, which would tend to lead to a more balanced diet.
Or did they unconsciously do it, for example
Probably mostly unconsciously. But I would not bet that the idea pulses should be mixed into the grains was never expressed: I've met what I consider an example of specific appetite for protein, and know of others that they did make the experience that "protein really helps" in the context of long distance hiking. Similarly, without the name protein it's just possible that someone somewhere vocalized the impression that grains + pulses are better than just grains.
It has been demonstrated that rats have an innate specific appetite for protein that kicks in in case of protein deficiency or high protein need (pregnant rats)(see wiki page linked above for source). In humans, there are also indications that protein intake is actually important for the regulation of overall food intake, and takes (to a certain extent) precedence over energy intake (protein leverage hypothesis) [Gosby et al.: Testing Protein Leverage in Lean Humans: A Randomised
Controlled Experimental Study, PLOS One, 2011].
Again, this hints at a situation where pulses may have been highly valued right from the beginning - at least where meat, fish and eggs were scarce, and milk for adults was not yet an option. If high-protein sources are available, then of course, additional carboyhdrates without much protein is fine. Keep in mind that very roughly speaking at the same time (after all, domestication of the first grains wasn't something that happened in just a few years, we're talking about a period of a few 1000 years), not only agriculture started but also domestication of goat, sheep, cattle, chickens.
Also, the protein leverage hypothesis (and the fact that this hypothesis is just under study more or less now instead of being centuries-old wisdom that has been subjected to rigorous study decades ago) may point to this important regulation of protein intake being not so easy to detect during "real life nutrition situations". Which would make a conscious decision to work towards farming pulses as well as grains unlikely.
were there some evolutionary/selection process that caused people who consumed balanced diet to survive and produce more offstring?
Yes, and that evolutional/selection pressure is happening since far longer than the "groups of people"/"societies" that @MarcCWallace and @Semaphore write about:
We share the T1R taste receptor family not only with mammals but with vertebrates in general. And, as this question is mainly about protein, there is indication that the sweet receptors are variants of the (older) umami receptors. Yarmolinsky et al.: Common Sense about Taste: From Mammals to Insects, Cell, 2009. Older here is sometime between when fish decided to take over land and before mammals evolved!
(Note that this means we have the ability to detect protein since long before we became humans, but that doesn't necessarily mean that protein precedence and craving for variation are as old: they could be driven by occupying our ecological niche more recently. Still, my personal guess is that the importance of protein is also old.)