Preheat oven to 350°F (175°C) and position a rack in the center. Lightly grease a 9-inch (23 cm) square or round baking pan, or line the bottom with parchment.
Whisk together flour, sugar, baking powder, and salt in a large bowl. Cut in cold cubed butter with a pastry blender or fork until the mixture resembles coarse sandy crumbs.
Tip the crumbs into the prepared pan and press firmly and evenly across the bottom with your fingers or the flat base of a measuring cup. Prick the crust a few times with a fork.
Peel and slice fresh peaches into ½-inch (1 cm) slices, or drain canned and pat dry thawed frozen peaches. Arrange the slices over the crust in an even, slightly overlapping layer.
Stir together 3 tablespoons sugar and 1 teaspoon cinnamon, then sprinkle evenly over the arranged peaches.
Whisk the egg yolks until smooth, then add sour cream, sugar, flour, vanilla, and almond extract if using. Whisk until completely smooth with no streaks.
Pour the custard slowly and evenly over the peaches, letting it settle into the gaps around the fruit. Bake for 40 to 45 minutes, until the edges are set and lightly golden and the center jiggles only slightly.
Move the pan to a wire rack and let the kuchen cool for at least 45 minutes before slicing, as the custard firms up considerably as it cools. Serve slightly warm or at room temperature.