The thermoelectric conversion efficiency problem: Insights from the electron gas thermodynamics close to a phase transition