Prepare the filling.
Mix the cream cheese, powdered sugar, and vanilla extract until smooth. Line a small freezer-safe tray with plastic wrap. Divide the filling into 10 equal mounds and freeze until completely solid.
Beat the butter and sugar.
In a large bowl, beat the cold cubed butter and brown sugar until well combined. Scrape down the bowl as needed.
Add the eggs.
Beat in the eggs until incorporated.
Finish the dough.
In a separate bowl, whisk together the flour, cornstarch, and baking soda. Gradually mix into the butter mixture just until combined. Fold in the grated carrots and optional walnuts.
Chill.
Cover the dough and refrigerate for 1 hour. Check that the filling portions are frozen solid before assembling the cookies.
Prepare the oven and pan.
Preheat the oven to 390°F (200°C). Line a baking sheet with parchment paper.
Fill the cookies.
Divide the chilled dough into 10 equal portions. Flatten each portion into a thick disc and place one frozen cream cheese mound in the center. Wrap the dough around the filling, pinch the edges closed, and gently shape into a ball.
Bake.
Arrange the cookies on the prepared baking sheet, leaving plenty of space between them. Bake for 17 minutes, until the edges are set and lightly golden. Keep any remaining dough balls refrigerated while baking in batches.
Cool.
Remove from the oven and allow the cookies to cool completely on the baking sheet before moving or serving.