It’s a bit unusual , but not unprecedented, for players to sign extensions during the season.
In Lara’s case (if it is indeed an extension), the logic seems to track. It’s unlikely the Brewers would have been interested in a long-term deal with Lara before this season.
As the season progressed it’s plausible that the Brewers saw enough to believe that this is someone they wanted to build around and approach Lara’s representation to gauge interest in the last week or two.