The effect of local atomic relaxations on the structural stability of the peculiar quasiunidimensional $\text{H-}R\text{-H}$ pair ordering occurring at low-temperature in a series of hexagonal rare-earth-hydrogen solid solutions, $\ensuremath{\alpha}\text{\ensuremath{-}}R{\text{H}}_{x}$, ($R=\text{Sc}$, Y, Ho, Er, Tm, and Lu) is studied by means of density-functional theory. We are proposing here a first-principles-based model, which, by considering the relaxation of the host metal cell, yields for the first time a suitable explanation for the observed chainlike short-range ordering through a coherent stress field along the chain, as well as for its limitation to the six metals in question---a phenomenon never completely understood theoretically.