I think that the main issue is that this isn't really how Node.js works. But also, allowing external dynamic JavaScript (which I think is what you are asking for?), would potentially be a security weakness.
There are, of course, now several mechanisms to support this. You mention globals and you can certainly reference an external module in setttings.js which load functions into the global context.
You can also create a runtime and/or an editor plugin which can add extra features.
And, of course, you can create your own Nodes.
But all of these require Node-RED to be restarted in order to pick up changes because that's how node.js generally works.
It isn't impossible to have something that could pick up dynamic changes but it isn't really simple and could open Node-RED to other issues if not treated carefully. And we remember that even changes to flows cause at least part of Node-RED to restart on each deployment.
For what you want, I would think that your current best option would be a local custom node module, possibly with a background watch function to restart node-red as needed.
There is though, a more radical option. Just because you have the hammer of Node-RED does not mean that every compute job is a nail! 
You could easily create another node.js (or Python, Go, Rust, ...) microservice with an API (websockets, mqtt, http, tcp, udp, UNIX Pipes, ....) that contains your custom functions and you interface with that from your Flows. Best of all worlds.