core: Ensure config directory exists before getting lock

Fixes startup on first time use, regression from a9829c60