Yes, building components in your factory will reduce time for refits to ships just as it reduce time to build new ships.
In my case I build ship components with planetary industry as war production when I need to produce as many ships as fast as I can. Using planetary industry for ship components are in my opinion not efficient if I have no real need for the ships in the immediate future.It will detract from the industries capacity to build more useful things (such as mines, factories and other planetary installations) which would expand my empire .
As with everything in this game, it is always a fine balance between what you need and what you have available.