This pull may be slightly controversial, but I dare say that GetDataDir() is never used on any performance critical paths (and if it is, it is a bug).
It’s not that heavy in the first place.
This change simplifies the code (no more ClearDatadirCache) and removes any pathCached/csPathCached destruction order problems (if they are still around).