Optical switching of topological phase in a perovskite polariton lattice