Es is a fill-in substantive used when you are in desperate need of a subject or object, but there isn't one. Take the simpler sentence
Wir machen es gemütlich.
We make it comfortable.
See the es in the English sentence? In both German and English, es is the direct object, and required.
Wir machen es uns gemütlich.
We make us comfortable.
German and English differ about who is the direct object. English thinks us is the direct object because it is made comfortable. German instead still thinks es is the direct object, because the surroundings are made gemütlich ("pleasing") to uns (which is the indirect object).
So this is all about a different view what "gemütlich machen" means.