Messages in the Cloud with multiple Apple IDs
Solution 1:
Don't turn on iCloud Messages for either device.
You can continue to use iCloud Backup and include your Messages, if you want them backed-up. If not, leave that off, too.
As previously mentioned, sharing Apple ID's nowadays will start causing more problems as Apple and developers start using individual iCloud accounts for more individual use.
Perhaps looking into other photo sharing options to get what you need, until Apple does something, is the better short-term approach.
Solution 2:
You cannot turn on Messages in the Cloud on an iOS device wherein the Apple ID for Messages differs from the main iCloud Apple ID. iOS will notice that the Apple IDs do not match and will deny the request to turn on Messages in the Cloud. It will show this error message: