Films of all-important compound hafnia (HfO2) can be prepared in an orthorhombic ferroelectric (FE) state that is ideal for applications, e.g. in memories or negative-capacitance field-effect transistors. The origin of this FE state remains a mystery, though, as none of the proposed mechanisms for its stabilization -- from surface and size effects to formation kinetics -- is fully convincing. Interestingly, it is known that doping HfO2 with various cations favors the occurrence of the FE polymorph; however, existing first-principles works suggest that doping by itself is not sufficient to stabilize the polar phase over the usual non-polar monoclinic ground state. Here we use first-principles methods to reexamine this question. We consider two representative isovalent substitutional dopants, Si and Zr, and study their preferred arrangement within the HfO2 lattice. Our results reveal that small atoms like Si can adopt very stable configurations (forming layers within specific crystallographic planes) in the FE orthorhombic phase of HfO2, but comparatively less so in the non-polar monoclinic one. Further, we find that, at low concentrations, such a dopant ordering yields a FE ground state, the usual paraelectric phase becoming a higher-energy metastable polymorph. We discuss the implications of our findings, which constitute a definite step forward towards understanding ferroelectricity in HfO2.