Let's focus on one problem at a time.
nah i think the other problem is more interesting than gases. one at a time is so '90s. witness:
-it seems intuitive that random space dust which became the core is cold because space is cold... but remember space is cold because it's empty-ish and the core is very much not empty, so lots of heat got trapped in the core. there was, at the time, lots of jostling. jostling is heat.
-as mr. devac pointed out, we can figure out how old rocks'n'stuff is sometimes by measuring radiation, which is just more heat
-also the layers of the earth trap heat pretty well right, i mean there's a ton of magma down there and not many access points on the surface
and the sheer magnitude of energy is unnerving--
temp of sun at surface 6000 kelvin. temp of earth, at same, a few hundred. massive difference in energy, so a sort of "arbitrage" occurs (obviously not really, and not forever, pace second law) and order springs from disorder. because order is just spending energy to create a temporary equilibrium. anyway, i don't know a damn thing about the thermosphere but the point is we don't really blast that much heat out. we trap it, and have since day 1, and we also accidentally used it to create a bunch of neat shit. https://en.wikipedia.org/wiki/Autocatalysis#Creation_of_order
borrowed time, but then we're in good company -- the whole universe is borrowing too