Gravitational instability in two-phase disks and the origin of the moon