Make the is_compatible() and implements() caches more race-safe.
Imported from
https://youtrack.roxen.com/issue/PIKE-192
Reported by
@grubba