gravitational energy and internal energy
Can the release of gravitational energy during planet formation in principle (is there enough) explain this much heat


Planets in general can have internal heat sources (like radioactive breakdown or a complex hot core).  During planetary formation there are thought to be multiple collisions with large proto-planets before things settle down to a more-or-less stable set of orbits and planets.  These collisions add energy to the planets as they develop and increase temperature (a lot), as does ongoing bombardment from boring-old asteroids.

Now all of this energy does basically come from gravitational sources, but as you can see it's a complex (messy) business and there are many significant events that can alter temperature.

It might be instructive for you to read about existing theories on the formation of Solar system as well as material related to the structure of the Earth.