Dimensional reduction, magnetic flux strings, and domain walls