Harnessing gauge fields for maximally entangled state generation