  The analysis of phase transitions of gauge theories has relied heavily on
simplifications that arise at the boundaries of phase diagrams, where certain
excitations are forbidden. Taking 2+1 dimensional $\mathbb{Z}_2$ gauge theory
as an example, the simplification can be visualized geometrically: on the phase
diagram boundaries the partition function is an ensemble of closed membranes.
More generally, however, the membranes have "holes" in them, representing
worldlines of virtual anyon excitations. If the holes are of a finite size,
then typically they do not affect the universality class, but they destroy
microscopic (higher-form) symmetries and microscopic (string) observables. We
demonstrate how these symmetries and observables can be restored using a
"membrane patching" procedure, which maps the ensemble of membranes back to an
ensemble of closed membranes. (This is closely related to the idea of gauge
fixing in the "minimal gauge", though not equivalent.) Membrane patching makes
the emergence of higher symmetry concrete. Performing patching in a Monte Carlo
simulation with an appropriate algorithm, we show that it gives access to
numerically useful observables. For example, the confinement transition can be
analyzed using a correlation function that is a power law at the critical
point. We analyze the quasi-locality of the patching procedure and discuss what
happens at a self-dual multicritical point in the gauge-Higgs model, where the
lengthscale $\ell$ characterizing the holes diverges.
