Baryons in the Cosmic Web of IllustrisTNG-II. The connection among galaxies, haloes, their formation time, and their location in the Cosmic Web