The SqlMainDom lock is required while running on Azure - this is configured via an app setting:
<add key="Umbraco.Core.MainDom.Lock" value="SqlMainDomLock" />
If this app setting is applied before Umbraco has been installed the application fails to start. This kind of makes sense as there's no database to apply the lock.
However the same issue occurs when performing an upgrade. If you upgrade Umbraco 8.5.x => 8.6.x and apply the new app setting, the application fails to start unless the upgrade has been performed first.

It seems a little unnecessary for Umbraco to obtain a lock before / while upgrading, and the error causes a lot of confusion.
Maybe I'm missing a very good technical reason, but I feel this error could be avoided by only applying the SQL lock when Umbraco is fully initialized.
We have that captured here as we ran into it ourselves 馃槄 ... Or well, similar issue (around a clean installation but assume its the same underlying issue)
Excellent!
I tried to look through the commits but couldn't directly see anything fixing this... Looking forward to v8.6.2 馃槑
I'll close this as a duplicate of #7967
Most helpful comment
We have that captured here as we ran into it ourselves 馃槄 ... Or well, similar issue (around a clean installation but assume its the same underlying issue)
https://github.com/umbraco/Umbraco-CMS/issues/7967