Can olivine be used to make glass?
You could proceed from either end member of the olivine solid series and yield $\ce{SiO2}$ as you suggest.

However, I'd consider mechanisms that have been researched in the course of studying so-called mineral sequestration in addition to what you've written, especially considering the energy requirements you propose: the mineral sequestration reactions are (slightly) exothermic and would thus also yield heat as a by-product which I suspect would be desirable in a cold place like the Moon. That said, the reactions are slow at standard conditions and can be accelerated at the cost of supplying energy. How that balance works in your scenario is ultimately up to you, of course.

Additionally, carbon dioxide is a reactant (but needs to be in a supercritical state, which costs energy), which you'd get from human respiration and other organic sources "for free," which relieves you of having to have a lot of hydrogen gas on-hand.

The idea with mineral sequestration is to allow supercritical carbon dioxide to react with certain minerals to yield carbonates that are stable over some long time period:


  Mineral carbonation reactions are known to geologists and occur spontaneously on geological time scales. For example, the reaction of $\ce{CO2}$ with common mineral silicates to form carbonates like magnesite or calcite is exothermic and thermodynamically favored.


An example is:

$$\ce{Mg2SiO4 + 2CO2 -&gt; 2MgCO3 + SiO2}$$


  (which) illustrates the transformation of forsterite, which is the end member of the common silicate mineral olivine. One ton of olivine can dispose of approximately two-thirds of a ton of $\ce{CO2}$. Again, the reaction is
  exothermic and releases 90 kJ/mole of $\ce{CO2}$. 


In summary: There's nothing wrong with your chemistry or geology and there is more than one way to yield silica from mafic/ultramafic minerals.

The reference I have quoted above and cited below also details the process in general terms for minerals such as olivine and serpentine, and illustrates schematics for implementing such schemes on industrial scales, which might also be of interest to you.

Reference from the National Energy Technology Laboratory within the DOE:


  Goldberg, P. ,Chen, Z. Y. ,O’Connor, W. ,Walters, R., and Ziock, H. $\ce{CO2}$ Mineral Sequestration Studies in US. Technology. 1 (1): 1–10 (2000).