rts: Lookup symbols in relevant DLLs only (originally !11164)
This originally was !11164 (closed). I have picked it up and improved in various ways to make it mergeable, retaining the Core idea/part of the patch from !11164 (closed). Most of the MR related discussion happened there instead of here.
This MR fixes #23415 (closed).
Edited by Rodrigo Mesquita