In December 2023, Google announced it would change how Google Maps' location history feature worked. The feature, called Timeline, would switch to saving your location history on-device rather than storing it in the cloud like it did for years. Since the Timeline data is on-device, you may lose it if you lose your device or switch to a new Android phone. You should turn on cloud backup for your Timeline data to avoid such a scenario.
As Artem Russakovskii points out on X (formerly known as Twitter), Google Maps has a cloud backup feature for Timeline. However, contrary to UX best practices, this feature does not have any onboarding screens, so users simply do not know it exists. You have to manually turn this on to back up your Timeline to the cloud, which would also be the only way to preserve your older data that hasn't yet been deleted in case you lose your device or want to switch phones.