Fixes the cyclic dependency issue as described in #18131. (cherry picked from commit eaa0e19a34)
eaa0e19a34