[runtime] Avoid joining attached threads. Fixes #19343.