If we go back to the origins of chocolate in Latin America, the consumption of the processed cacao was not for a post-supper treat. For one, it was only available for men of status, seen as an "intoxicating food," highly valuable and prestigious.
Besides religious and festive occasions, chocolate was used both by the Mexica (Maya, Aztec, etc.) and subsequently the Europeans for medicinal purposes. The brewed chocolate beverage was used to treat stomach and intestinal complaints, acting as a laxative. Combining ground cacao beans in a drink with other ingredients - such as bark, roots, and grains - could treat anything from infections and coughs to fevers and fatigue. Often, though, cacao was simply employed to make unpleasant medicinal herbs more palatable!
More modern interpretations of cacao for medicinal purposes, beginning in the 16th century, make use of chocolate as a beverage, as well. Different combinations of the cacao bean varieties treat various ailments. For example, if one suffers from thinness, a mixture of pochotl and cacahoatl can make someone "extraordinarily fat." In the US, I think we have gathered as much, although we rarely use chocolate explicitly to treat that malady! Rather, in the 20th and 21st centuries was have come to realize the benefits of the phytochemicals present in cacao ... at least the dark stuff. For those unfamiliar with phytochemicals, those are things like betacarotene, found in fruits and vegetables.