$\Lambda$CDM and early dark energy in latent space: a data-driven parametrization of the CMB temperature power spectrum