We report on multiple fundamental qualitative improvements in the growth of improper ferroelectric hexagonal YMnO$_3$ (YMO) thin films and heterostructures by pulsed laser deposition (PLD). By a combination of pre-growth substrate annealing and low-energy-fluence PLD, we obtain a two-dimensional growth mode of the YMO films on yttria-stabilized zirconia (YSZ) with ultralow roughness and devoid of misoriented nanocrystalline inclusions. By inserting a sacrificial manganite layer capped with conducting indium-tin oxide between the substrate and the final film, the latter is grown in a fully lattice-relaxed mode and, thus, without any misfit dislocations while maintaining the extraordinary flatness of the films grown directly on pre-annealed YSZ. This provides a template for the fabrication of heterostructures based on hexagonal manganites as promising class of multiferroics with improper room-temperature ferroelectricity and the implementation of these into technologically relevant epitaxial metal|ferroelectric-type multilayers.