This is not a bug. I recall Apple introducing this sort of functionality as a feature a couple versions of MacOS ago. I've always had it happen (not consistently) with Safari, and occasionally Mail. It seems the Messages implementation is new to Mojave.
Ah... I found this article explaining Apple introduced "automatic background quit" in 10.7.
Ah... I found this article explaining Apple introduced "automatic background quit" in 10.7.