@Umetsu I believe that's correct. In the previous chapters I'm pretty sure it was the case that on switching, his outfit would be changed to the magical girl outfit, so his male clothes would become female. And on switching back, ONLY the clothes that he switched to would be switched back.
So since he's wearing a uniform that wasn't from the switch, he had to take that off (to not tear it like the dress he tried on), but the underwear was just going to go back to his normal underwear after, since that was from the transformation itself.
@MavB_Ver I think that's probably a pretty good idea as to what happened, if for no other reason than it could be a bug. Who knows how the feature was thrown together; it could easily be a bug.
@MavB_Ver
normally that would be the case, but since solving things that way would be anticlimatic we coud also assume the new update inserted an unexpeeted bug along with the feature.