Revealing the galaxy–halo connection in IllustrisTNG