I'll go ahead and make the case for modifying your workflow to fix your problem. This will solve your problem as long as you aren't philosophically opposed to the change.
If you keep all your windows merged (i.e. all your Chrome windows are simply tabs), you will know when you are closing the last window. This also gives you some other navigation shortcuts as well.
Convenient Keyboard Shortcuts
- Close Tab: ⌘w
- Next Tab: ⌘}
- Previous Tab: ⌘{
These commands plus your ⌘q to close can make life pretty simple if your working with merged windows. You'll know if you're on the last tab in this case and be able to just close the application instead of closing the tab.
This answer isn't meant to dodge your real question, it is just an approach that fits with Chrome's apparent interface design on Mac OS.
Toward Changing Chrome's behavior
One potential approach to getting exactly what you want is to create an Automator action that would accomplish what you want. I'll leave this approach to those more experienced with Automator and Chrome.app. Along that line of thinking, a service that uses AppleScript may be an option. Chrome supports AppleScript and this vague Google article has me thinking one could
- Check the length of the
BrowserList cited in the article
- Close the Application if the list of windows is 1, otherwise close the window.
The resulting service could then be assigned to a keyboard shortcut. See Step 5 in this article for how to do that.