Typically, error thrown indicates user issued create database request whereas the logical server is not in ready state to get the database created.
We would suggest user to wait for logical server creation and associated update of logical server to complete before creating logical DB.
Or create logical DB immediately after logical server creation complete, then update logical server related properties in ARM template.
Hence, as an alternative is to introduce a Wait operation into the ARM template for delaying the script execution until the background task has finished.
The Wait can be achieved by using the deploymentScripts feature; deploymentScripts allows you to inject script commands into the ARM deployment and, for example, execute a PowerShell sleep command.
The key is to set the dependencies of the steps correctly. You need to make the wait/sleep operation depending on the preceding deployment step, then have the next deployment step depending on the wait/sleep operation. You usually declare dependencies by referring to the resourceId of the object that was deployed on the preceding step, but you can also use the name of the preceding step.
You may check out the suggestions in these doc, as a reference:
Microsoft.Resources deploymentScripts and Work with outputs from PowerShell script