Before I install the chain I watch from behind whether the dérailleur sits straight under the smallest cog. You can adjust it by turning the high limit screw. Then I install the chain and tighten the tension of the cable. After this I install the chain and shift to the biggest cog. Again check whether it sits straight under the cog. But I think it doesn´t matter if you install the chain from the beginning or not. I don´t do it, because so I can see it better how it sits under the smallest cog. Other say it is better with the installed chain, as they don´t watch he dérailleur , they watch how the chain runs on the smallest cog.. I would say check how it´s better for you. Watch either the sit of the dérailleur or check how the chain rides on the smallest cog.
I usually check limit screw adjustment on the derailleur before installing the chain or anchoring the cable. Once that is set I install the chain, and run through remainder of derailleur setup. Honestly though you could do whatever you want. I've done hot swaps of rear derailleurs before too, meaning that I yanked out the lower pulley on the old (usually wrecked) derailleur to slide the chain out and installed the new one in opposite order. It still works the same, and in this case since I don't need a new chain it saves me a lot of time.
I would install the derailleur first, then you can feed the chain through the derailleur before putting the change together. Otherwise you install the chain, then you need to take apart the derailleur and set it up around the chain. Then once you have the chain and derailleur on, you then set up the derailleur.