Nanomachines, son. Sounds like the easiest way to introduce the concept of fast in-combat repairs of robotic units, while keeping it belivelable. Nanite repair grenade and such would be possible.
I'll be blunt about this: iudging from what we see in the game, the proposed level of nanotechnology far exceeds not only X-Com, but even the aliens themselves. An Ethereal would consider it "pure science-fiction".
If such technology existed in the game, everything would be completely different. None of the weapons or units would make sense. Heck, none of the
tactics enabled by X-Com mechanics would make sense, since everything would be about nano cloud warfare.
Add to this the dubious value of nanomachines on a battlefield in general - due to very poor resistance to sunlight, heat, even mild chemicals etc.
Nanotech is very promising, but mostly in medicine, as the inside of a human body is much friendlier than the outside, and also the potential applications are much more subtle than "build a tank". If you really want macro-scale effects, I'd rather suggest doing something like the "living metal" from 40k, or the T-1000 structure - but it's not exactly the same thing as a nano cloud, and still above Cydonia tech level.
Sorry, I don't mean to bash the idea, and I really appreciate the brainstorming, but I really want to get this point across - nanomachines are not an answer to every engineering problem.
While I don't know anything about coding, I also (sort of) came up with solution for repair implementation. If it would be possible to somehow make armor on certain units degrade faster than on others, then it could be used.
Giving drones a lot of armor, but also a lot of damage vulnerabilities (like 200% base, instead of 100%) then armor would act like drone HP, while normal HP would act as "internal critical damage" that wouldn't be possible to repair in combat. Then the repair bits could be taken from 40k mod, from their "Servitor" that has inbuilt weapon that "heals" armor on attack and is used for that purpose.
The 40k solution is indeed the closest thing I can think of. I'd really like a real engine solution, though. The real problem being the weapon only applicable to mechanical units - but there is not even such tag, and tying it to zombiImmune, bleedImmune etc. might be a bit clunky. Negative damage based on a special resistance would work, but would make armour entries look weird (a human unit would still show "resistance" to this "damage type" as 0%). This is why I'm not that keen on drone repair as a feature, given the current options.