Gas-phase spectra of MgO molecules: a possible connection from gas-phase molecules to planet formation