I am using a slightly big modpack with few mods that change enemies specifically and bullets so this might totally be the fault of that BUT, should the defensive drones instantly start attacking the hacking device causing it to die before it can hack unless you have robots to constantly repair it?
The intention was for them to attack the hacking device if otherwise not threatened, but you should be able to distract them from doing it.
How does your defense look like and on which alert levels you get problems?
You definitely need at least two turrets, one that shoots the access keys, and one that attacks the bots. And how it currently works I would also expect the turrets to need repair at least sometimes on medium alert levels. Rarely at low levels.
For me the turrets were usually targeted before the hacking device, would be interesting if that is different with your setup. Could be other mods if so, or different turret placement etc. Not sure how the AI determines their targets.
For low levels, the initial bots have very long warmup time and should die before they are able to attack at all. Even with one turret with normal magazines in them.
Higher levels should be harder, but not sure yet if the current approach is the correct one. Always happy to get more feedback on this.