It depends a lot on the type of factory. For example, for the last couple decades semiconductor manufacturing is fully automated except for maintenance (including installation here) and contingencies when maintenance is happening (people moving wafers around with carts when the automated handling system is down). Part of this is certainly that the advanced processes can’t be done by humans anymore, due to precision, scale, contamination, and safety reasons.
BUT the humanoid robots would be useless.