Their iCloud security page says “Safari History, Tab Groups, and iCloud Tabs” is end-to-end encrypted. So they store history to sync across devices but the keys are only on your devices.
https://support.apple.com/en-gb/guide/security/sec0a319b35f/...