Jacques Lucke and Brecht Van Lommel worked on the feature so that the user is warned if modified images have not been saved:
Not only for Texture paint, but also for baking system.
The only thing that would remain is that when the image has never been saved, for example when the novice user starts a Texture Paint project and she/he has not realized that the image will not be saved by default just by saving the .blend file.
What I mentioned above saying that it was still missing is already implemented with this complete Brecht commit:
You notice that the task is old, but I think that it has been possible to complete it thanks to recent changes.