I've had this bug happen a few times where I can't build factories or other buildings with commander/fabbers. It doesn't happen that often (happened in my last game so I wanted to report it) but when it does it happens during the whole game. I'm on the steam version of the game (not PTE).
Do you still get the white outlines of the buildings you want to build? If so, it may simply be a case of having accidentally turned the power off for that unit. That happened to me once as well. So next time it happens, can you click on the unit that's not building and check if the power symbol in the menu on the right is still the blue lightning bolt and not a grey one with a red X on it?
I think I did get these outlines but I had removed the key binding for "energy toggle" so I don't think I turned off energy in the right side menu. I'll keep an eye on it. Thanks!