Copied Factory into Puppet's Bunker
Actually it makes a bit more sense when you think of what was going on in the Copied Factory. The Machine Lifeforms inside the raid were hacked and under the command of 9S. In his native game he is a extremely skilled hacker. As 2P is 9S' enemy, naturally they targetted her and anyone with her because they did not have a choice in the matter. Had 2P not been present, the robots would have likely still attacked us but 9S would have probably been a bit more open for conversation.
As for the boss, the Machine Lifeforms were experimenting with birth as explained in the collectables after the raid. 1 in 2B's room and 4 in the command center. As for why the boss looked like that... Yoko Taro likes to make grotesque giant women. He's weird like that.