Fix bug in plugin path caching

Fixes #9263