Is there a better way to trigger automatic changes based on current Focus mode? (v10.2)

Keyboard Maestro (v10.2)
macOS 14.5, iOS 17.5.1

I've read a number of older posts on the forum trying to solve this problem, and I have a (mostly) working solution here. The setup is as follows:

  1. Keyboard Maestro has a remote trigger set to change my system to dark mode when called (this stopped working unexpectedly the same day until I found this post that seems to have resolved it for now)
  2. Automations on iPhone set to trigger when each focus turns on (and separate automations when they turn off) each calling the Keyboard Maestro remote trigger (they also write a file to a folder that Keyboard Maestro watches, but this is unreliable when my phone is not connected to Wi-Fi even though my iCloud sync is set to use mobile data, which is how I came to use the remote trigger as well)
  3. A simple Apple Shortcuts shortcut exists to get the current focus mode and copy the name value to a Keyboard Maestro variable
  4. Keyboard Maestro macro triggers based either on the system appearance change or when it sees a folder added to the designated directory*: it runs the shortcut above to determine the current focus mode then executes accordingly

An issue that I'm having is that sometimes the macro sees no focus mode and executes according to that when my devices are still changing modes—and then doesn't execute again when the new focus is actually enabled. I tried to add some short pauses in different places, but that actually seemed to break things rather than help (no idea why). This only seems to happen when the focus mode changes on its schedule, since the old mode will turn off before the new mode turns on, thus triggering the iphone automations based on disabling and then enabling, which means that the remote trigger is called twice in a short time.

I expect there's some sort of bottleneck perhaps? But since I need focus modes to be driven by my iPhone and want specific conditions automatically set on my Mac based on any given focus mode and other conditions based on no focus mode, I'm not sure how to solve this. I considered a second remote trigger for the disabling focus automations on the phone, but I think the same problem would persist, wouldn't it?

*I still use the folder change trigger in addition to the system appearance change (remote trigger) as a sort of back up in case the remote trigger fails for whatever reason (such as if the Mac is asleep or off), but I'm not sure if this is actually working the way I expect.

So it might be the issue is not (or not always) that Keyboard Maestro isn't registering the trigger. Sometimes I get error notifications from Shortcuts saying something to the effect of 'time limit for remote execution exceeded', which could mean the trigger just isn't being executed. Some search results indicate this might be to do with Apple Watch actions timing out (though not necessarily), so I'll try removing those actions from the automations to see if the macro triggers more reliably.