Tips: Delaying the start of iTunes to avoid the missing library error on macOS
If you're running a machine with external drives, it's possible that they won't be mounted when iTunes starts looking for data. AppleInsider explains how to get around this, with a simple AppleScript.

While iTunes and Photos data is generally stored on the system drive, users with especially large libraries can move them to external drives, or network shares to save limited space. Given how the macOS works, and the relative slowness of external media, an app that can't find its data complains, and asks to re-locate the library.
A very simple script, coupled with proper system configuration can be used in place of manually launching iTunes after the entire boot cycle is complete. Here's how to do it.

Reboot to test.

While iTunes and Photos data is generally stored on the system drive, users with especially large libraries can move them to external drives, or network shares to save limited space. Given how the macOS works, and the relative slowness of external media, an app that can't find its data complains, and asks to re-locate the library.
A very simple script, coupled with proper system configuration can be used in place of manually launching iTunes after the entire boot cycle is complete. Here's how to do it.
Configure the system to not bypass your hard work
- Select "restart."
- Before the 60-second timer expires, uncheck "reopen windows when logging back in."

Remove external drive-dependent apps from starting by themselves at launch
- Open "System Preferences" and open "Users and Groups"
- Remove apps that are giving you grief about missing data by selecting them, and hitting the - button

Write the script
- In the Utilities folder, open "Script Editor"
- In the AppleScript window, type:
Other applications can be added to the list, in the same syntax as "iTunes" above.Delay 10
Tell application "iTunes" to launch
Make the AppleScript applet, and make it launch on start
- Still in the Script Editor, select Export from the File menu
- Change "File Format" to "Application" and hit save
- Re-open "Users and Groups"
- Add the applet you just made to your list of startup items, by hitting + and navigating to where you saved the applet.
Reboot to test.
What to do if it doesn't work
Some drives spin up faster than others. The "Delay 10" line in the script works with all the external enclosures and drives we've tested it with, but adding a few more seconds may be necessary, depending on your hardware.

Comments
2) May I suggest also including an Automator-based option?
3) It's beyond my ken, but it's possible to only have the app(s) run only after the drive (or network share) has been mounted, which could save a couple seconds. Even more complex, you could have it send you a notification—assuming this is a headless Mac, like in my case—if the drive isn't mounted, which means the app(s) then don't launch.
I'm not sure if the following would work via Automator, but here's an example:
Here's a link to an Apple Script for mounting an external drive:
"Tell application Logic Pro X to launch"
In place of, before, or after the iTunes line.
Maybe I'll submit a request next week, but this would be such a low priority that I'm skeptical that they'd ever add it.
Script is exact copy of one posted:
delay 10
tell application iTunes to launch
Result
error "The variable iTunes is not defined." number -2753 from "iTunes"
I could use the Advanced Option for the user account to change its path to the external drive so that full disk encryption on my external drive would be in play, but that would also mean creating an limited access user account that would automatically login and then I'd have to load the external drive and then switch user accounts, and then logout of the limited access account so it's not using any resources. This could be automated but it's still a lot of rigmarole for something I was was a built-in option, and feels too un-Appley to me.
Am I missing something simple that's already designed to do what I want?
For what it's worth, I use an external drive and have never had this problem (evidently my external drive is fast).
iTunes should really be able to accommodate multiple music locations or libraries simultaneously so that there could be a local audio store, an external and a network share at the same time. On adding music, it would be dragged into the appropriate location. This applies to all their apps like Photos having multiple libraries and families can have a shared library as well as each person having a personal one. They'd still need the feature to wait on each being available but wouldn't have to hold up the app from loading.
Write the script
should be updated to include the quotes around iTunes?
BTW, I appreciate articles like this. I've been a Mac user since the beginning, and I forget that AppleScript is still an option.