It seems to me that a /takebyai <AIname> command wouldn't be too hard to implement, in the way hoijui suggests indeed. Pause game, load AI, call UnitCreated for all units that are being given to it, unpause game (or let user do this?), and voilà, feature implemented.
Big risk of course is to not accidentally load AIs which then can't handle this and crash the entire game. There is unfortunately no way to prevent this apart from good testing of the AI.
Also if someone takes a look at this, I suggest making it so that there is another command with which you can still take the stuff from the AI later, in case it behaves too stupid
