Yes, indeed primarily from fat. The body is able to use the glycerol backbone from triglycerides to make glucose, alongside several other things like proteins and lactate. Since calories are a measure of heat energy, they are a reductive measure when it comes to nutrition. Much better to think in terms of nutrients.
Stated another way, there is no such thing as an essential carbohydrate. This has been in scientific literature for a very long time.