Issue #19232: Fix sys.modules lookup (--without-threads)