I will admit, when it came to brainstorming sources of crashes with threads, AI has helped me find sources I hadn't considered (as a systems guy, multi threading real experience is something I am sprinting through)
I suspect the best solution will be architectural, which promises to be a pain.
A language choice is a starting point but you have to know the techniques of architecture learned.
That's the issue with the new "memory is cheap" model. I cut my teeth with 256 BYTES (not KB or MB) of space for the program, the stack, and the scratch.
But I've gotten sloppy, over the years.