"i got a planet with 2 legions(earth), got the shipyard near earth, but i cant build a transport because of the lack of legions."
FYI once you garrison legions to a planet, they are no longer available for invasions. Unassigned legions are considered a global resource. Another words if you have legions unassigned, you can build a transport at any shipyard. On the flip side, transported legions can't be garrisoned.
My advice is too go offensive with legions rather than defensive. The same transport can invade multiple worlds while garrisoned legions are stuck on their assigned world.