Preheat the oven to 300 degrees F.
First, cut the spaghetti squash in half and remove the seeds. Place the squash on a baking sheet and bake for 1 1/2 hours. As an alternative, place on a plate and cook in the microwave on high power for about 20 minutes.
Put the garlic head on a baking tray. Drizzle with 1 teaspoon olive oil. Season with salt and pepper and put in the oven for 30 minutes or until the garlic is very tender.
In a bowl, mix the bread crumbs with the milk. Let stand for 5 minutes until all the liquid has been absorbed. Mix in the pine nuts, the eggs, basil, thyme, and parsley. Put aside.
Mash the potatoes with the butter, goat cheese, cooked garlic puree and cream to make them nice and smooth. Season the potatoes with salt and pepper.
Remove the spaghetti squash flesh with a fork and put it in a bowl. Season with salt and pepper and put aside.
Preheat the oven to 450 degrees F.
For the vegetables: Heat the remaining oil in a large pan and saute the onions, carrots and celery over medium heat until soft and translucent, about 5 minutes. Add garlic and mushrooms and continue cooking until brown, about 10 minutes. Remove from heat. Add the cooked lentils and the reserved bread crumb mixture. Stir and put aside.
In an 8 by 11-inch/20 by 28-cm baking dish, spoon the vegetable mixture onto the bottom. Layer with the spaghetti squash, then the mashed potatoes and smooth them down. Cook in the oven for 30 minutes or so, until the top is slightly browned. Garnish with fried shallots, to taste.