dtach is exactly what you're looking for.
There are other similar tools. I personally found zmx to be the best, but it's more feature rich than dtach, and might be more than you want. Dtach is pretty minimal. But my only issue with it is it struggles with reloading a terminal session for a TUI that needs non trivial redrawing.