The Buffybot in the Season 9 cartoons is constructed from parts that Andrew discovered in Warren's lair. The original Buffybot was destroyed in Buffy: Bargaining, Part 2 but it appears that Warren had sufficient parts and equipment to build an entire new unit (in fact several, if you don't mind it having more than one left arm).
As to when the swap occurred, the implication is that it happened sometime between the end of #03 and the start of #05, when the fact that she couldn't metabolise food started to become noticeable.
We actually see the transfer (which involves a mind-transfer) taking place in flashback in #08.