You can force the right setting when you push, with a pre-push hook.
All you need to do is to write a script (in any language you prefer) to test whether you have the flag set to the correct setting, and if not, to fail with an error message.
You could also make a pre-commit hook that disallows commits to a certain branch (e.g. master) when the flag is set incorrectly.
However, there is one big problem with this strategy: you're encoding part of your workflow into the history of the project, every time you commit with the flag in the unpublishable state. (A similar example would be to commit temporary files generated by your IDE, and then to delete them before publishing. They would still be a part of your history (unless you rebase) and this is obviously bad.)
A better strategy would be to modify your project or tools to turn on the developer setting when a certain file is present (maybe an empty file called .development), and to ignore that file, so that it never shows up in your history, and you still get the right setting locally simply by creating that file. How difficult this is to do depends on what other technologies you're working with. I haven't figured out how to do this with cabal for example.
Another strategy which would work in every case, but be less convenient, would be to add a pre-commit hook which would always reject the developer setting. So, when you're working locally with the developer setting turned on, you'll get an error message when you commit. To commit at all, you'd have to avoid adding the unpublishable state, which might require using git add --patch, and definitely means you can't use git commit --all.