Reaction of metals with water
In general, the reaction of metals with water could produce either the oxide or the hydroxide.  Roughly speaking, most metals are capable thermodynamically of displacing hydrogen from water to form the hydroxide, but in many cases you need such a high temperature to run the reaction that the hydroxide is not stable and thus we go over to the oxide.

To show the variety of possible reaction routes let's look at a few cases:

Iron

Iron does not react with water alone under ambient conditions; a simple reaction between iron and water requires steam at a high enough temperature to destabilize any hydroxides.  You therefore get only oxides, generally $\ce{FeO}$ or $\ce{Fe3O4}$.

But if you add the supplemental oxidizing power of air, then iron can react with both the water and the air to generate rust -- a mixture of hydroxide and oxide compounds, or even  oxide-hydroxides like $\ce{FeO(OH)}$ with iron(III).  The hydroxides become possible precisely because the combination of air and water lowers the reaction temperature to make it so.  See Wikipedia for a fuller explanation of the many reactions involved in the rusting of iron.

Magnesium and Calcium

Magnesium is something of an intermediate case between metals that clearly react with water alone at ambient temperatures and those that do not.  Magnesium reacts slowly at ambient temperature, possibly generating enough hydrogen bubbles to temporarily float pieces of the light metal in the water.  Reaction is faster in boiling water.  In both of these cases the hydroxide $\ce{Mg(OH)2}$ is a stable product; but this decomposes at $350 \, \pu{^\circ C}$   From that temperature upwards, including burning the magnesium in steam, you will get $\ce{MgO}$.

Calcium more clearly reacts with water under ambient conditions to give $\ce{Ca(OH)2}$, but this also transitions to forming $\ce{CaO}$ as the hydroxide decomposes at $580 \, \pu{^\circ C}$.

Alkali metals

In general, alkali metals react so rapidly with water and the hydroxides are so stable that at least for all practical purposes, we expect exclusively the hydroxides.