Charge-density-wave order with momentum $(2Q, 0)$ and $(0, 2Q)$ within the spin-fermion model: continuous and discrete symmetry breaking, preemptive composite order, and relation to pseudogap in hole-doped cuprates