Your suggestion was a plot point in one of Asimov's original robot stories!
There was a robot on some hot, unforgiving planet or moon.. Io? Mercury? Its duty was to perform some kind of mining, I forget.
It never encountered humans that were not co-workers (supervisors) and it was expensive...
So, the engineers tweaked the weight of the second and third laws so that it would tend to protect itself from the environment, even if a human carelessly ordered it to perform some work that it might not survive.
The story started when careless orders were indeed given. The robot began to "act drunk", as in it was wandering around singing. The recurring character "robot psychology expert guy" showed up to unravel the mystery (which I already spoiled in the previous paragraph).
Found the one I was thinking of: https://en.wikipedia.org/wiki/Runaround_%28story%29 It's interesting that I remember the story incorrectly.