Interplay between lattice gauge theory and subsystem codes