M dwarf habitable zones move inward with time over the star’s extended pre-main sequence phase such that rocky planets that are currently orbiting in an M dwarf’s habitable zone may have once orbited interior to it. Before the habitable zone contracts to envelop the planet, the planet will likely be in a runaway greenhouse phase, losing water from its atmosphere while outgassing carbon dioxide to its atmosphere. Once the habitable zone contracts to the planet’s orbit, any water outgassed from the interior may condense to form liquid oceans, if the surface temperature and pressure allow liquid water to be stable. However, if the planet has outgassed enough carbon dioxide during its runaway greenhouse phase, surface temperatures will be too high for outgassed water to condense and the planet will not be habitable. To calculate the rate of carbon dioxide outgassing before the habitable zone reaches the planet, we add a geochemical model to the VPLanet software package that self-consistently tracks water and carbon dioxide flows across a planet’s mantle, crust, and atmosphere for a stagnant lid tectonic mode. Our model simulates the interior thermal evolution of the planet (including the core) to calculate outgassing rates from magma production rates over time. We also simulate the evolution of the host star to calculate the rate of atmospheric escape of water during its runaway greenhouse phase. We validate our model by reproducing the 92 bars of carbon dioxide and 30 ppm of water vapor observed in Venus’ atmosphere today, as well as its lack of a magnetic field. We then apply this validated model to calculate the coupled atmosphere-interior evolution of the potentially habitable TRAPPIST-1 planets, assuming they possess stagnant lids and Earth-like compositions. We identify the parameter space in which our simulated planets become habitable after their host star’s pre-main sequence phase. We show that the habitability of a planet currently orbiting in the habitable zone around an M dwarf depends strongly on the initial carbon dioxide budget and the fraction of magma that erupts to the surface (extrusive volcanism) on that planet. While planets in the habitable zone with low initial carbon dioxide budgets or low fractions of extrusive volcanism can support liquid water, planets that have outgassed too much carbon dioxide during their runaway greenhouse phase will, despite being in the habitable zone, become Venus-like worlds with thick carbon dioxide atmospheres and no liquid water. We investigate TRAPPIST-1e’s potential habitability and demonstrate that, assuming an Earth-like composition, it requires a carbon dioxide budget on the order of bars or an extrusive volcanism fraction of 0.001 to become habitable after the pre-main sequence phase. Our model shows that TRAPPIST-1e’s potential for habitability is severely limited unless it is either volatile poor or erupts very little magma to its surface.