Gluconeogenesis in the liver
The brain and also the erythrocytes need glucose to survive.
Gluconeogenesis is one of the possibilities of the body to keep the glucose levels stable and to avoid hypoglycemia. The precursors needed come from amino acid and lipid metabolism, and is turned on, when the body has no energy sources available which can release glucose, like carbohydrates in the food or the degradation of glycogen.

As you said, it comes at a price, making glucose itself costs a lot of energy. This process is available to maintain the level of glucose, which shows the importance of it.