I heard that the electronic structure of the precursor is changed and the valence state difference occurs due to metal ion doping, so I wonder how this improves structural stability.
I think it is a principal of least action known from mechanics.
If we assume that space is discrete on fundamental level and consists of action quanta h (recall the formula for the photon energy ε=hν), and the outer electrons in an atom distort the surrounding space the most, then there will be nothing surprising in the fact that the valence electrons of neighboring atoms combine to distort the surrounding space together in a minimal way. This enhances the interaction of atoms with each other, makes the crystalline structure of the substance more ordered and strong.
You can better understand what was said if you get acquainted with my last year's report on how the thermal expansion of the elements of the periodic table in the solid state occurs and depends on:
Preprint Thermal expansion of solids or how the space in crystals is ...