Why do you think ocean crust contain rocks more dense then earth rocks??
The closest thing we have to the raw material of planets is a class of meteorites called carbonaceous chondrites. After every big construction job, there are scraps laying around and carbonaceous chondrites are the leftovers from the building of the solar system. Take away the elements that would go into gases, and what’s left is a good match for the composition of the Sun. Carbonaceous chondrites are rich in oxygen, silicon, iron and magnesium.
Melt that raw material and let it cool and the result is basalt, the stuff that is oozing out of the ground in Hawaii, makes up the dark plains on the Moon, and covers much of Mars, Venus, and some asteroids. And is probably abundant on every planet in the Universe. When the crust in the oceans spreads apart and new magma fills the gaps, it hardens to make - basalt.
On the other hand, when crust is subducted, or dragged back into the earth’s interior, it only partially melts. The melted stuff includes elements with large radii, like potassium, sodium, and calcium. The earth’s interior is dominated by relatively small atoms like iron and magnesium, and when it melts, “misfit” elements get crowded out. Over many cycles of melting and remelting, granite forms. Granite is less dense than basalt (2700 vs. 3000 kg/m^3) and granitic crust is thicker (40 km vs. 5 km for basaltic ocean crust). Ocean crust is lower because it’s thinner and denser. Water fills in the low areas, so “oceanic” crust is oceanic because it’s under water. But there’s a bit more water than it takes, and some slops onto the continents to form the continental shelves as well as big inland seas like Hudson’s Bay, the Baltic, and the Persian Gulf.