do_evil_thing() needs to check the environment for which mod requested it and not which mod is running currently.
request_insecure_environment() needs to set "environment.mod = mod with this command in it's code" and prohibit further change in this instance of insecure_environment.