ConfigFileStorage::initializeStorage in core/includes/config.inc
Create a configuration directory, if it does not already exist, and ensure it is writable by the site. Additionally, protect it with a .htaccess file.
file_ensure_htaccess in core/includes/file.inc
Creates a .htaccess file in each files directory if it is missing.
file_requirements in core/modules/file/file.install
Implements hook_requirements().
system_check_directory in core/modules/system/system.module
Checks the existence of the directory specified in $form_element.
system_requirements in core/modules/system/system.install
Implements hook_requirements().
telemetry_telemetry_data in core/modules/telemetry/telemetry.telemetry.inc
Implements hook_telemetry_data().