Role of lattice distortion and A site cation in the phase transitions of methylammonium lead halide perovskites