Hard to say if your issue is the operating system, the logic version, or something else.
I'm using Logic 10.5.1 on a 2012 laptop with OSX Mojave on it and I have no issues.
Maybe you should consider updating to OSX Sierra first. See how that works.
Because if you buy Logic X now, I don't know if it will let you buy the newest version (meaning an older version instead of the latest) for the OSX version you have right now.
The App Store has been acting very stubbornly lately.https://support.apple.com/en-us/HT211683
I would not update to Catalina in your case with a 2012 iMac.