If you click this button:

in Messages, then the picture is saved to Photos.
As razmee209 says, this is independent of the Messages, and it will stay in Photos as long as you don't delete it from there.
Of course, the best practice is to keep backups to an external drive. To back up your pictures you can just plug in an external drive, select the pictures, and use Share>Save to Files. Alternatively, you can backup to a computer:
Transfer photos and videos from your iPhone or iPad to your Mac or PC
If you haven't done one of those backups, then your remaining pictures continue to be in peril.
iCloud backups are very limited. The only safeguard iCloud offers is that you can replace your information if your phone gets run over by a truck, or something. But if you accidentally delete stuff, iCloud backs that up, too, and so your stuff is gone. iCloud is not a backup service-- iCloud is a synchronization service.