Mechanics-coupled stability of metal-halide perovskites