mktempdir uses tempdir to choose the default parent of the temporary directory, so for example you can do
withenv("TEMP" => pwd()) do
# do something...
end
This isn’t perhaps exactly what you asked because you’re only affecting the parent of the temporary directory, but you don’t have to edit in place the source code of the package, which is a bad idea.