The "creating dir/file during load config" is a longstanding and complex problem. This PR only does a quick patch, it still needs more refactorings in the future. Fix #25938