Dolomite in deep-water environment
For dolomitization to occur, either by primary precipitation or by diagenesis, requires a highly magnesian environment and alkaline conditions. The most favourable environment for this to occur is by deeply circulating seawater into the upper mantle which underplates oceanic crust. I don't mean the hydrothermal circulation around spreading centres (which is acidic), but the relatively mild temperatures of submarine groundwater. In the occasional cases where this upper mantle is obducted onto land as ophiolites you will find magnesite predominating, with minor huntite, and dolomite of various early and late-stage paragenesis. The process of serpentinization releases aqueous magnesium, and reaches pHs as high as 12. Moreover, the associated dolomitization starts in the marine environment, and continues after the ophiolite becomes land. For example, you can go to the Semail ophiolite in Oman and find primary and secondary dolomite precipitating - along with occasional metastable huntite and hydroxycarbonates.