Text this: Structural semiconductor-to-semimetal phase transition in two-dimensional materials induced by electrostatic gating