The MillenniumTNG project: intrinsic alignments of galaxies and haloes