It actually wouldn't be that difficult to avoid what you describe as "silly sci-fi crap" scenarios. The key concept is autonomy.
Meatbag infantry aren't that autonomous to begin with. They need their supply lines; an army marches on its stomach. And they need orders. For every squad of grunts shooting/getting shot at there's a legion of grunts keeping them in ammo, food, water and fuel, bare minimum, and and whole line of dummies (excuse me, officers) telling them where to go and what to do. Interrupt either and they stop being effective in a hurry.
Despite these limits infantry are still the MOST autonomous branch of the military. Tanks need entire shops for of full time specialists, aircraft spend more time getting fixed than getting flown, and ships go through fuel by the tanker.
A super advanced drone with onboard guidance still needs fuel, and if it wants to kill anyone, ammo. And it'll probably need a direct order, possibly with an access code, to unlock its weapons, seeing as ROE are already that restrictive for human soldiers.
And the kinds of traits your talking about in an advanced computer - self-determination, intellectual autonomy, freedom - are the polar OPPOSITE of what the military wants in a drone. If Cyberdyne made a pitch to the Pentagon that started with "Our new T800 Killbots are able to learn, think and adapt", they wouldn't make it halfway through the first PowerPoint slide before getting politely asked to leave. Top brass don't even want regular grunts doing any of those things.