In your case, the categories are loaded all-at-once and then cached. It happens in GetRoot(), either indirectly (if you call anything else than GetRoot) or directly (if you call it directly).
If you add, change or delete any category they are cleared from cache. Then you start over and all are reloaded next time one or more categories are needed. So it is pretty efficient.
When calling EpiServer's APIs, does it load all related entitties or does it enforce lazy loading?
var rootCategory = _categoryRepository.GetRoot();
var subCategories = rootCategory.Categories; //Were these loaded in the previous call or are they loaded on this call?
Is there a way to make sure that all entities are loaded in the initial call?
Thanks in advance!