It goes something like this: the humans have colonies the moon but barely and have built their very first exploration ship. Then the aliens come into the system and secretly take some Marines onto their ship to use as soldiers to fight their war. They shoot a missile of some kind into earth's core making earth almost uninhabitable, but don’t realize people live on the moon. They end up putting the marines in mech suits to quell resistance form other aliens species.
The theme of "fighting the aliens' war" comes by in the Ranks of Bronze series by Weber et al., and other books as well. A similar theme with Earthmen fighting aliens of very different technological level - this time, accidentally - is The High Crusade by Poul Anderson (and a yet different take on the theme, with even more accidentality, is Turtledove's The Road Not Taken).
But from the planetkiller missile fired at Earth's core, this is in all probability the Galactic Empire Wars series (specifically volume 1: Destruction) by Raymond L. Weil. Those on the cover are the mecha suits.
This is the blurb from Amazon, which matches your recollection (emphasis mine):
To the Kleese, the Earth is nothing more than a planet full of conscripts to fight in their wars of aggression against other planets. The Kleese are one of three large Galactic Empires that control the majority of the galaxy. To them, Earth is a dangerous planet due to the aggressiveness of the humanoid species that inhabits it. This is a species that cannot be allowed to go out into the galaxy. Once they have taken their conscripts, the planet will be destroyed.
Mason Randle controls the Smithfield Mining Corporation. His main base is inside the asteroid Vesta, and he will do everything in his power to save what is left of the human race after the Kleese attack.
This is the scene where the planetkiller missile hits. If I remember correctly, the Kleese had known of Luna City as well as the asteroid colonies, but believed they wouldn't be able to survive without the Earth for resupplies.
“The aliens have launched what appears to be a missile toward Earth,” Darren replied in a strained voice. “We’re tracking it, and it will impact the planet in six minutes.”
[...] On the screen, Luna City had now turned from tracking the alien ship to tracking the inbound missile that was targeting the Earth. [...] “Impact,” Darren spoke over the com, sounding confused. “We’re not seeing or recording any type of detonation.” [...] “I don’t like this,” spoke Drake, clenching and unclenching his fist as he continued to watch the screen, which was now focused on South America. “We’re missing something. There has to be a reason why the alien ship launched that missile, and I can’t believe that it malfunctioned.”
(the missile hadn't detonated yet. It was still burrowing towards the core).