Prevent macOS Messages.app from quitting when I close its window? I use a very specific workflow with the Messages app on the Mac:

Read my messages
Close the Messages window with CMD-W
Messages app is still running
When a new message comes in, CMD-Tab to the still-open Messages app
Press CMD-0 to re-open the Messages window

After closing the Messages window, the app has always remained open and running in the Dock and app switcher.

In Mac OS 10.14 Mojave, I similarly close the Messages window. After closing the Messages window, the Messages app is still in the foreground, running, and shows the menu bar.
When I click to some other app, however, the Messages app then immediately seemingly Quits.
The dot disappears from the dock, and (this is the key issue) I can no longer CMD-Tab to the Messages app in the app switcher.

I'm forced to go click the dock icon with my mouse or otherwise re-open the app, which is inconvenient and annoying.
After the app has Quit, besides being &quot;Quit&quot;, it seems to behave more-or-less exactly how it used to behave pre-Mojave. The Messages process is still running and visible in Activity Monitor. Notifications continue to arrive. The dock icon gets badged.

How do I prevent Messages from quitting when I close its window?

rdar://46142132 - Mojave Messages.app should not quit when I close its window
Engineering has determined that your bug report (46142132) is a duplicate of 42085189 and will be closed.

Related links:

With Mojave (macOS 10.14), why does the Message app close itself?
Messages app now quits when close window?

Messages app quits on Mojave instead of closing
As far as I can see that's just another case of "Automatic Termination", similar to Preview, QuickTime Player, etc.

If you launch Terminal (from /Applications/Utilities/) and run the following command with Messages quit, Messages should stop terminating, when the window is closed:

defaults write com.apple.iChat NSDisableAutomaticTermination -bool yes

Then press enter.

To undo it again:
defaults delete com.apple.iChat NSDisableAutomaticTermination