Defect-induced local variation of crystal phase transition temperature in metal-halide perovskites