Seems a bit foolish on Kun's part to remain on Yavin 4 undefended... how did the Republic fleet managed to invade Yavin 4 so easily?
The Republic gained some minor victories that, in combination, led to the Republic attacking Yavin 4. Ulic led the combined force of the Jedi and the Republic to Yavin 4. When the Jedi began the invasion, Exar Kun began a ritual that would drain the Massassi Warriors of their life energy to feed his spirit. This would allow him to continue his war against the Jedi as an unstoppable spirit. The Jedi, Nomi Sunrider in particular, realized what was about to happen, so they imprisoned his spirit on Yavin 4 so that Kun would never again wage war on the galaxy.
The Republic would have never made it to Yavin 4 without the knowledge that Ulic had. And it wasn't the Republic that gained the victory, the Jedi secured victory in the war. Armies of Jedi made several victories in the war that pushed Kun back to Yavin. The Republic would have lost without them. That's why Kun created the Terentetak beasts and sent them to Tython.