I guess it'd be a good idea. Often it doesn't even attack my ships which are far weaker than his fleet passing by.
I remember once I played as Terrans. All enemies were set to normal difficulty with one exception - the Dreghis who were set to genius or incredible. Surely they went to war with everyone and started swallowing the galaxy like the Golden Horde, but they sat at the opposite corner so I could build up.
At some point Altarians surrendered their resources to me. They were next to dreghis, but it'd take 20-30 rounds at least for me to start bringing first ships there. So I used a starbase which at that point still provided some protection. I rushed a shipyard, build a ship with legions and stationed it at that starbase. I started building military ships.
At the worst moment I had just two planets in this corner and I needed to recapture them every few rounds with this legion ship and a few battle ships I built.
What's the problem: while passing by they never touched the shipyard.