The Evolution of Galaxy Star Formation and Morphology in Groups and Clusters with IllustrisTNG