The current accepted idea for the Moon's formation is the "Big Splat" hypothesis (which is not the same as the Big Bang theory of the creation of the universe). It's also called the "giant impactor" hypothesis by those with smaller senses of humor.
In short, a Mars-sized body hit the forming Earth a glancing blow. The cores of Earth and impactor merged, and a great deal of molten rock was thrown into space. Some of this rock fell back to Earth, some went into Solar orbit, and the rest formed the Moon.
This happened long before the seas formed.
See
the article about the Moon in Wikipedia, and its links in the Origin and History section.
Fred