How can I stop newly arrived NPCs from falling into my lava moat?

Solution 1:

The simplest way? Cover the moat with a layer of dirt in the short term.

The "this is awesome" way"? Build a "draw bridge". This requires access to the engineer. This is a guide on the official forums explaining how. The video is excellent; he narrates exactly what he has done and even uses annotations in the video to make sure you understand what's going on.

the drawbridge can be toggled via switch. When it's "on", there's a path. When you turn it off, the blocks are not active and so it's open air. Toggle it on when you're waiting for an NPC to spawn and then back off again once they're all moved in.