This is a topic that comes up from time to time. Our recommendation is usually to either write a native extension, like this A* path finding extension, or use a Lua coroutine and divide the computation over many frames.
I think it would be possible to build something very similar to the Love2D Thread system. Such an extension was created a couple of years ago: Experimental Threading extension.
(Today I’d probably look into using the Defold job system instead of going straight for the low level thread API).