Tracking the X-ray Polarization of the Black Hole Transient Swift J1727.8-1613 during a State Transition