[runtime] Use the system limit when enforcing a new thread stack size. Fixes #17908.