The only reason G-d would come first is because we weigh out (the idea of) G-d vs your family.

If your G-d is a good G-d than you promoting or obeying that G-d will yield greater ethical results on earth than your family could produce. (at any given moment)

But this is because he has proven to us he is just and ethical (through the laws he has given us) then we reciprocate with trust and obedience.

Which is why anyone with a family would ever volunteer to fight a war when the chance of them loosing their lives was a reality..

Because the ideal they were fighting for (being embodied by that country) outweighed the ideal of having and loving ones family.