Don't ignore config file `sock_dir` setting. Fixes #8365.

Only afterwards try the system default path.
Merge remote-tracking branch 'upstream/pr/9416' into develop