Tuning the quantum phase transition of an ultrathin magnetic topological insulator