It couldn’t have happened billions of years ago. The earth is only 6,000 years old.
Indeed the moon could have been wondering around the universe for billions of years, and when G*d created the earth, the gravitational pull of the new planet snagged the moon into place.