I could not test it in 6.4 yet, but in 6.3 the orbital habitats would sadly not provide their population to shipyards, so you indeed need a planet or asteroid to be populated. It doesn't need to be inhabitable though, as you could also drag infrastructure or underground infrastructure there.
The whole thing is not
that easy though. You will need quite the equipment+mineral storage to fully drag around a shipyard that would be operational everywhere. Actually you could calculate all the stuff around, hmm... .
Ok, let's assume a military shipyard of 15k and one slipway, so that counts as 30k tons when tractored, which means you need around a 15k ship if you want it to be up to speed with other ships of the line.(optional) That shipyards needs 1.5m guys running it, which translates in 150 cryogenic transports, who are 375k tons on a ship. I've never come to use underground infrastructure from 6.4 until now, so let's assume you find some col cost 2 planet somewhere, which means 200 infrastructure per million, so 300 in our case.(not counting eventual col.cost reduction tech) You will need 30 cargo holds for that, which are 750k tons on freighters, so we are up to 1125k.
I suppose underground structure is much less efficient though, because why else would you still use normal infrastructure otherwise? And then you need to add some storage to your likings depending on which and how many ships you plan to build otherworlds. You can therefore plan for at least 1.2mt+engines and stuff ships need to get around, just to run a single slip 15k shipyard everywhere. Probably even tenfold that or so, depending if you truly want it everywhere (including asteroids and uninhabitable worlds) and underground stuff is really that much more inefficient as habitation.
Conclusion: It is not easy, but possible. You should have a good reason to do it, but I guess having a "replicator" settlement close to your deepest expansion border can have its benefits. You would just casually send freighters there and feed the depots a new load, so they can go on. The task becomes quite monumental if you want more than just a little slipway though, so funding a real colony might actually be more beneficial.(travel times are not that daunting, so every serious colony could easily supervise and provide production for around 3-5 system jumps around it)
I do something similar myself all the time, though I let some shipyards be underpopulated as they are only run very rarely anyway, and probably just for repairs, which go by fast. However, my reasons are different. I just don't want to have colonies, so everything has to be in space...
Gas Giants by the way will never work. You simply cannot claim them, just like stars.