See the article What does iCloud back up? - Apple Support
Your iPhone, iPad, and iPod touch backups only include information and settings stored on your device. They do not include information already stored in iCloud such as Contacts, Calendars, Bookmarks, Notes, Reminders, Voice Memos4, Messages in iCloud, iCloud Photos,
2. When you use Messages in iCloud or turn on iCloud Photos, your content is automatically stored in iCloud. That means that they're not included in your iCloud Backup.
Read Restore all content to iPhone from a backup - Apple Support