You're on the right track. As @carterza says doing it with dynlib is doable, I
created a hot reloading system for gdnim, a fork of godot-nim. Don't use nimble
as a build system, it wasn't designed for that. For gdnim and NimForUE we have
a custom build script. For NimForUE we build a host and guest dll. The host is
loaded by the Unreal editor and the guest is hot reloaded. We've had to dig
around in the nimcache to modify cpp files and have a custom build script.
Basically we use nim to generate cpp, do some necessary modifications for
Unreal, generate a pch, then call the backend compiler/linker.