### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a bug report that matches the one I want to file, without success.

### Electron Version

17.3.1, also affected: 16, 17, 18, 19, 20

### What operating system are you using?

macOS

### Operating System Version

12.3, also affected: Win, Linux

### What arch are you using?

x64

### Last Known Working Electron version

15.3.4

### Expected Behavior

Requesting `app.requestSingleInstanceLock()` on first start of the app should return `true`.

### Actual Behavior

Requesting `app.requestSingleInstanceLock()` on first start of the app returns `false`.

### Testcase Gist URL

https://gist.github.com/6d51100568b78f98c5177cb27d370f9f

### Additional Information

It seems that the issue only exists when setting the `userData` path to a non-existent folder (which is most likely the case when you start the app for the first time on a fresh computer). Subsequent starts result in correct behavior because the folder has been created by then. The issue was not present in E15 and below; I'll bisect further.

The issue becomes problematic when implementing a behavior as described [in the docs](https://www.electronjs.org/docs/latest/api/app#apprequestsingleinstancelockadditionaldata) because the app will just quit on first start:
```js
const gotTheLock = app.requestSingleInstanceLock(additionalData)
if (!gotTheLock) {
  app.quit()
} else {...
```

cc @miniak 

_funfact: this was a pain to debug since it crashed our CI in a very obscure way 😆_ 
shell/browser/api/electron_api_app.cc
return g_browser_process->GetApplicationLocale();
}
std::string App::GetLocaleCountryCode() {
  std::string region;
#if BUILDFLAG(IS_WIN)
  WCHAR locale_name[LOCALE_NAME_MAX_LENGTH] = {0};
  if (GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SISO3166CTRYNAME,
                      (LPWSTR)&locale_name,
                      sizeof(locale_name) / sizeof(WCHAR)) ||
      GetLocaleInfoEx(LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_SISO3166CTRYNAME,
                      (LPWSTR)&locale_name,
                      sizeof(locale_name) / sizeof(WCHAR))) {
    base::WideToUTF8(locale_name, wcslen(locale_name), &region);
  }
#elif BUILDFLAG(IS_MAC)
  CFLocaleRef locale = CFLocaleCopyCurrent();
  CFStringRef value = CFStringRef(
      static_cast<CFTypeRef>(CFLocaleGetValue(locale, kCFLocaleCountryCode)));
  if (value != nil) {
    char temporaryCString[3];
    const CFIndex kCStringSize = sizeof(temporaryCString);
    if (CFStringGetCString(value, temporaryCString, kCStringSize,
                           kCFStringEncodingUTF8)) {
      region = temporaryCString;
    }
  }
#else
  const char* locale_ptr = setlocale(LC_TIME, nullptr);
  if (!locale_ptr)