We theoretically consider ultracold polar molecules in a wave guide. The particles are bosons, they experience a periodic potential due to an optical lattice oriented along the wave guide and are polarised by an electric field orthogonal to the guide axis. The array is mechanically unstable by opening the transverse confinement in the direction orthogonal to the polarizing electric field and can undergo a transition to a double-chain (zigzag) structure. For this geometry we derive a multi-mode generalized Bose-Hubbard model for determining the quantum phases of the gas at the mechanical instability taking into account the quantum fluctuations in all directions of space. Our model limits the dimension of the numerically relevant Hilbert subspace by means of an appropriate decomposition of the field operator, which is obtained from a field theoretical model of the linear-zigzag instability. We determine the phase diagrams of small systems using exact diagonalization and find that, even for tight transverse confinement, the aspect ratio between the two transverse trap frequencies controls not only the classical but also the quantum properties of the ground state in a non-trivial way. Convergence tests at the linear-zigzag instability demonstrate that our multi-mode generalized Bose-Hubbard model can catch the essential features of the quantum phases of dipolar gases in confined geometries with a limited computational effort.