Here's what works for me:
Set the default startup action in Logic to 'Do nothing'.
If the Coremidi error message occurs, quit and restart Logic instantly.
Voilá, no error this time.
my setup is: Mac Mini 2018, osx 10.14.5 (Mojave)
Intrestingly, this error never came up for a month since i started using Logic. At one point, my 2 year old ...