NOTE: See the edit history if you're curious on updates / timing of this
To clean up from this - you may have to both update iOS / macOS and perform operations on
/var/db/lockdown that are more complicated than removing a folder / file.
On to the story of how we learned this...
I've been working with AppleCare on this issue for about 2-3 months now. The Apple engineers have confirmed to me that they can replicate the trust dialog box issue when the iPhone's Personal Hotspot is enabled, and connected to a Mac using Apple's official USB-A to Lighting cable. I believe that they replicated this using the same operating system as the one running on my MacBook Pro (macOS Mojave 10.14.6). So I'm not sure if it affects macOS Catalina, but I will be testing that shortly myself.
They are still investigating, but they said they're unlikely to patch up older operating systems. So I'll get back when I know more.
Some things to note in my case:
This is all happening with completely new and old Apple's official Lighting cables, but none of my cables have wear and tear, so unlikely to be a physical connection issue. Especially since they also can replicate it.
Resetting Privacy settings on the iPhone deletes the trust relationship with a computer, so after resetting this, it will prompt you to trust your computer next time it is connected via the Lighting cable.
Interesting to note, when it's prompting you to trust your computer for the first time, it will say:
"Your settings and data will be accessible from 'Name's MacBook Pro' when connected wirelessly or using a cable".
But after trusting it and connecting it again with personal hotspot enabled, it will say:
"Your settings and data will be accessible from this computer when connected wirelessly or using a cable".
Additionally, after the initial trust between the iPhone and the Mac, the Mac writes a plist file in the
/var/db/lockdown/ folder, which is titled your iPhone's UDID.plist.
This plist file is used each time your iPhone and Mac are connected via the Lighting to USB connection, to check that the devices have trusted each other. If the plist is missing, the Mac will prompt you to trust it from your iPhone before iTunes will recognise it.
Deleting the iPhone's associated lockdown plist file on the Mac, has the same function as resetting your iPhone's privacy settings (but on the Mac-side).
It's a bit more difficult to delete it, requiring SIP to be disabled and entering into Rootless. So unless you are very confident in working in rootless, there's not much point, as resetting Privacy settings on the iPhone has the same function. After resetting iPhone's Privacy settings and trusting your Mac from your iPhone, the old plist file is overwritten by a new one in the Lockdown folder.
Finally, I've noticed that if the iPhone and Mac are connected via the Lighting cable, and I disable or enable Personal Hotspot on my iPhone, there is a very quick disconnection/reconnection between the devices. I notice this on iTunes and can see it in the Mac's console log event messages.
The only solution so far is to ensure Personal Hotspot is disabled in the Settings app. Note that disabling the Personal Hotspot in the iPhone's Control Centre is not enough, as that just sets the discoverability off. You need to go to the Personal Hotspot settings in the Settings app to fully disable the hotspot.
As I said, I am unsure what the cause is, but I will update here when the Apple Engineers get back to me. But I hope this provides you all some additional information.
Please note this is my first time posting on Ask Different stack exchange, so I hope this post meets all the community guidelines :)
UPDATE 18 February 2020
I've just had a call from AppleCare. The Engineers have confirmed this is a bug that can be replicated on macOS Catalina 10.15. The Engineers have now escalated this to their senior Engineers to develop a bug fix.
As this is now out of the hands of my AppleCare Mac Specialist, my case has been closed, so it's unlikely I will receive any further updates on this issue. However my AppleCare Mac Specialist said "you've found a bug, and now we're going to fix it", so hopefully they will do this.
If I do get any further updates, I will post here.
UPDATE 18 September 2020
I've updated my iPhone XS to iOS 14 yesterday, and after testing various different scenarios, the issue no longer appears to be happening with or without the hotspot activated. Note, I have only tested this on macOS Mojave 10.14.6, so I cannot guarantee it has been fixed for earlier macOS versions, but suspect it has been fixed for at least Catalina and Mojave.
I will continue to monitor this just in case it does develop again.
I'm glad that a longstanding bug has been finally fixed and hope that my reports to Apple had contributed to this being fixed. Now if only Apple could fix the
usbd bug that causes connection issues between iPhones and Macs (mainly MacBooks) which I have described elsewhere on this forum...
Please let me know if you still experience this issue with iOS 14.
Hope this helps everyone!