Hi
There is no setting to disable the automatic folder creation. The automatic folder creation only happens when the user navigates to the documents tab for the first time.
You could trigger your flow on create of the record and create custom folder structure and then create the document location record for that particular record, setting the regarding and relative URL. Once the document location record is created for a record, the system will NOT create folders automatically because it knows there is already one setup.
In one of the projects I worked on back in 2015, I had to work on similar requirements like yours, that was for on-prem so I had the code in On Create plugin to setup custom folder structure and to create the document location record for that folder and never had any issues.
With the flow approach, only issue you will have is if a user navigates to the documents tab lets say within 10-15 seconds before the flow triggered, the system will automatically create the folders. This will lead to a record having multiple folder locations, perfectly valid but the user will have to switch between document locations in the documents tab.
To resolve the above issue, there are few approaches you could think about to improve how you setup the folder.
01. You could create your flow so that it can be triggered using HTTP request and call that flow from a plugin or CWA that is real-time (Sync). This will be a blocking operation so the folder will be setup as soon as the record is created and the users will not be getting any error and system wont create the folders automatically. Only downside to this approach is that when the user creates a record, the save will be taking few seconds more than usual save time.
02. You could create a real-time workflow and create a placeholder document location record (at this point this record wont have the actual folder path). And your flow can then setup folder structure and update the folder path to the document location record you created using workflow. This approach will give invalid folder path error for about 10-10 seconds if any user tries to navigate to the document tab within 10-15 seconds from record creation time.
Hope this helps