In a large bowl, beat the butter with the confectioners' sugar at medium speed just until blended. Add the ground almonds, cinnamon and salt and beat just until combined. Beat in the egg yolks and the rum, then add the 3 cups of flour and the baking soda and beat at low speed just until evenly combined. Divide the dough in half and scrape it onto 2 sheets of plastic wrap. Wrap the dough, flatten into disks and refrigerate until firm, at least 3 hours.
Meanwhile, puree the raspberries in a blender for 5 minutes. Transfer the puree to a medium saucepan. Add the granulated sugar and bring to a boil, stirring until the sugar dissolves. Simmer over moderate heat for 5 minutes. Stir in the lemon juice. Strain the jam into a bowl through a fine sieve and refrigerate until chilled, about 4 hours.
Line 2 large baking sheets with parchment paper. Liberally flour a work surface. Roll out 1 disk of the dough 1/4 inch thick, flouring the dough and the rolling pin as necessary. Using a 2-inch round cookie cutter dipped in flour, stamp out as many rounds as possible (to be used as the bottoms of the cookies). Using a small spatula, arrange the rounds about 1/2 inch apart on the prepared baking sheets. Gather the scraps and pat into a disk. Roll out and stamp out as many more rounds as possible. Refrigerate until firm, at least 30 minutes.
On a large sheet of floured wax paper, roll out half of the second disk of dough, flouring the dough and rolling pin as necessary. Stamp out as many rounds as possible. Using a 1/8-inch round cutter, stamp out the centers of the rounds on the wax paper; remove and reserve the centers. (These rings will be used as the tops of the cookies.) Slide the wax paper onto a baking sheet and chill the rings for 30 minutes. Repeat with the last piece of dough. Gather the scraps and pat into a disk; chill if necessary. Roll out and stamp out more tops and bottoms, then refrigerate.
Remove 1 sheet of the cookie bottoms from the refrigerator and brush lightly with water. Using a spatula, set the tops on the bottoms; press lightly to help them adhere. Prick the centers of the cookies with a fork to keep them flat during baking. Refrigerate until chilled. Assemble the remaining cookies.
Preheat the oven to 350°. Brush the cookies with the beaten egg and bake in the middle and lower racks of the oven for 18 to 20 minutes, or until browned and the glaze is lightly crackled; shift the pans from top to bottom and front to back halfway through. Transfer the baking sheets to racks to cool.
Spoon the jam into the cookies and let stand at room temperature for at least 2 hours, or until set.