I don't know how to "stop" the golems. In my games, they tend to make it to my homeworlds (or at least my planets adjacent to my home) no matter what I do. Sure, the gravity and the tractors pretty much stop everything else, but the golems make it through.
Thankfully, my defenses on my homeworld tend to be so crazy, that they are able to take out the golem before my home goes down, especially if I have mobile fleet support.
So that is one part of the answer, defense in depth.
Second, IIRC, golems cannot move through "blocking" forcefields, so if you pile a forcefield or two on the other side of your homeworld's wormholes (the side on the planets adjacent to the homeworld), that can buy you more time as the golem will be forced to take down the forcefield before entering your home.