Even more than that it is believed by many. The idea being humans evolved to enjoy sweet for the reasons you pointed out - it means carbohydrates which are dense in calories. Humans evolved to enjoy a certain amount of salt as it is essential to our survival; bitterness tends to be found in toxic things and is generally not palatable as a last warning to avoid ingesting bad food; Sour can be enjoyable but it also signals under ripe fruit and rotten meats as well as dangerous acid levels in some instances. Umami is thought to encourage the consumption of important amino acids.
It makes sense that earlier ancestors who maybe found bitter very enjoyable and sweetness not so enjoyable died off from a lack of calories or eating poisonous things before reproducing. And it makes sense that while across cultures people eat very different foods, you see the same patterns in terms of umami and sweet being considered desirable and bitterness often rejected.
In fact the human tongue is considerably more complex than traditionally assumed. For example, besides the umami taste receptors recently proven to exist there are also studies looking to see if we have taste receptors for "fat", "starch" and even "metallic" flavors, among other things.
The chemical reaction between molecules and how the brain decodes the signals produced by them is fascinating when it comes to the flavor of things.