As a rule, a CTE will NEVER improve performance. A CTE is essentially a disposable view. There are no additional statistics stored, no indexes, etc. It functions as a shorthand for a subquery. In my opinion they can be EASILY overused (I see a lot of overuse in code in my job).
Check the cupcakes at the minimum baking time. If the recommended baking time is 18-22 minutes, check them at 17 or 18 minutes (just a quick peek, make sure not to let too much heat out of the oven). If the tops are rounded and no long appear wet, they may be done.
Preheat oven to 350 degrees F (175 degrees C). Grease a 12 cup muffin pan or line with paper baking cups. In a large bowl, mix butter and sugar with an electric mixer until light and fluffy, about 5 minutes. Stir in the eggs, one at a time, blending well after each one. Stir in the vanilla and flour just until mixed. Spoon the batter into the prepared cups, dividing evenly. Bake in the preheated oven until the tops spring back when lightly pressed, 18 to 20 minutes. Cool in the pan set over a wire rack. When cool, arrange the cupcakes on a serving platter.