I’m sorry, but this is false. The default/conventional behaviour is for apps to keep running even if all their windows are closed.
There’s actually a toggle for this behaviour on the app delegate.[0]
You may be thinking about LSUIElement, which is loosely related, but doesn’t mandate that windowless apps must quit. [1]
0: https://developer.apple.com/documentation/appkit/nsapplicati...
1: https://developer.apple.com/documentation/bundleresources/in...