bpo-39947: Move get_recursion_depth() to _testinternalcapi (GH-18974)

Move get_recursion_depth() function from _testcapi to
_testinternalcapi to avoid accessing PyThreadState attributes
directly in _testcapi.
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 027f87e..3957258 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -241,7 +241,7 @@
         # mark". Otherwise, it may not be possible anymore to
         # reset the overflowed flag to 0.
 
-        from _testcapi import get_recursion_depth
+        from _testinternalcapi import get_recursion_depth
 
         def set_recursion_limit_at_depth(depth, limit):
             recursion_depth = get_recursion_depth()