Consider a null ClassLoader (typically the bootstrap CL) as cache-safe

Issue: SPR-11606
(cherry picked from commit a4a2e80)