No, no one said R2 is "stupid", but he is after all restricted by his programming. That "staying away" is what I've been wondering about. In ANH droids on Tatooine had a restraining bolt to keep them from running away. I don't know if that's a local Tatooine thing or general practice for droids. But even without that bolt, aren't droids generally required to obey their owners? So running away from Anakin wouldn't really have an option.