A redshift-dependent IRX-β dust attenuation relation for TNG50 galaxies