You're not wrong, but there's a small detail that your shell function doesn't solve for: unloading the environment variable once it's no longer needed.
If you maintain one shell per process-that-needs-a-secret-in-the-env then it doesn't matter, but if you're using long-running shells then direnv can load and unload env vars. It also gives you a nice little heads-up that it loaded/unloaded variables.