Yes, you can also do a similar strategy on the moon.

You can in principle create artificial magnetic fields. But yeah, you are better off just staying indoors most of the time under a big fat layer of regolith.