Safeties have a longer shelf life than CB's in general, which is why many corners convert to safety in the latter parts of their career.
That has some truth to it. Looking at CBs that made multiple first team All Pros in the last 20 years there is a pattern of their performance falling off once they pass the age of 30/31:
Richard Sherman - Managed a bounceback season with the 49ers at age 31 in 2019 before struggling with injuries in 2020. Looks like a shell of himself now as he tries to work back into shape with the Bucs
Patrick Peterson - Hasn't been All Pro caliber since 2018, now more or less an average CB at age 31
Aqib Talib - Had his final lockdown corner season at age 31, looked average while struggling with injuries in his last two years with the Rams before calling it quits
Darrelle Revis - Was getting burned a lot during his second season after his return to the Jets while age 31. Called it quits after a brief cameo the following year with the Chiefs in 2017.
Ty Law - Had a terrific season in his first year away from the Pats in 2005 at age 31. Bounced around between the Chiefs, the Jets and the Broncos in subsequent years.
Nnamdi Asomugha - Never lived up to the hype after joining the Eagles at age 30. Out of the league three years later.
Of course there are also a couple of exceptions, mainly Charles Woodson who had some of his best years when he was approaching 35 or Champ Bailey who managed a high level of production up until his final season when he dropped off a cliff at age 35. So it can't be automatically ruled out that Gilmore won't be able to produce at a high level. However, depending on what Gilmore was asking for an extension (e.g. continue getting paid like an All Pro) it can be understandable that the Pats didn't want to match his demands. Although I still wish they managed to find a way to keep him on the roster this year instead of trading / cutting him.