Vegetation patterning can both impede and trigger critical transitions from savanna to grassland