So your robots appear to be of two parts, which for parallel and simplicity I'll dub "the mind" and "the machine", glossing over that both parts are actually machines. The fact that "mind" can be forcibly disconnected from "machine" means that "machine" becomes remote controlled and, there is nothing that mind trapped within can do. Effectively "the mind" becomes locked in (actually, even worse than that), while "the machine" is controlled like a puppet.
External salvation
You say the hypothetical machine is forced to kill entire race (do you perhaps mean species? it's difference, for example, between going nazi/colonial and killing some types of humans versus killing all humans, race/species misuse is a pet peeve of me), but how is it supposed to achieve it? If household assistant robots have capacity to conceivably pull that off, your world is in deep trouble anyway, but hack on household robot would be easiest to defeat - humans interacting with it could notice a difference, especially if "the mind" is true Artificial General Intelligence with distinct personality. You would be concerned if your robot assistant would lose sense of humour overnight? Or suddenly became cheerful despite being called Marvin. Generally, all the usual tropes about clones or shapeshifters replacing people apply.
If your robot is, for example, managing non-sentient automatic factory, or is factory itself, then prospect is much more dire, but still change in communication patterns could be noticed by people or other AIs, and if possibility of puppeteer hack is known, risk would quickly be realised.
An actual tactical/strategic computer, like SkyNet, is the single worst situation, and if there are no requirements for manual approval, there's no time to external world to notice any change.
Hack back
But, even then, not all is lost. Your robots are sentient, but they are machines. How is protocol between mind and machine realised? Does the mind know the machine's programming? Can the robot sentience write machine code that runs the body (some humans can write machine code)? If yes, then it might be possible to fight the way out. Exploit the same hole that allowed puppeteer hack in the first place to gain any access to built-in radio/WiFi/FTLcomms/whatanot to send a call for help. Since mind can watch through puppeteer hack, there has to be some connection back to body, if only, signal confirming that audio/video/otherinfo was received. Perhaps in absence of main motor controls those feedback protocols can be hijacked to inject code back to body? Virus intended to shut down everything would be enough to force investigation. Depending on details, and specific AIs knowledge of programming (just because it's a machine "the mind" doesn't have to be good at programming any more than human has any business consciously manipulating composition of stomach acids) and infosec, it might have some fighting chance. Unless it's completely disconnected from body, but in that case AI will be completely disconnected from external stimuli and won't know anything that's going on.
Summary
Unfortunately, either way, best chance is to hope that attackers fail to emulate AIs personality well enough and someone notices. Perhaps deliberately store important facts as part of the mind, forcing attackers to query it for information, leaving way to either feed false information to tip others off, or way to fight back. If mind of your SkyNet is the only place where ICBM launch codes are stored, and launch sequence can't be bypassed, attackers can puppet the system all they won't, they can't succeed without torturing the info out of "the mind". At that point, the story would effectively become psychological thriller happening entirely within..