Linear dust polarization during the embedded phase of protostar formation