Residual stress in metal halide perovskite films intimately affects the photovoltaic figure of merit and longevity of perovskite solar cells. A delicate management of the crystallization kinetics is critical to the preparation of high-quality perovskite films. Only very limited methods, however, are available to regulate the residual stress of a perovskite film in a controllable manner, particularly for a perovskite film fabricated by a two-step method. Here, we demonstrate the construction of a hierarchical PbI2 scaffold inspired by Archaeoprepona demophon butterfly by combining an interlayer guided growth of porous structure and nanoimprinting. The hierarchically structured PbI2 that emulates the physical structure of the butterfly wing scale permits unimpeded permeation of organic amine salts and sufficient space for volume expansion during the crystallization process, accompanied by preferential perovskite growth of a defectless (001) crystal plane. The optimized perovskite film outperforms the control with reduced residual stress and defect density. Consequently, perovskite solar cells with a respectable power conversion efficiency reaching 23.4% (certified 23%) and an impressive open-circuit voltage of 1.184 V can be achieved. The target device can maintain 80% of initial efficiency after maximum power point tracking under illumination for 700 h. This work expands the range of engineering toward PbI2 by exploring a simultaneously tailored morphology and crystallinity and highlights the significance of a hierarchical PbI2 scaffold as an alternative choice to mitigate residual stress in a two-step processed perovskite active layer and boost the longevity of perovskite solar cells.