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.
Combine flour, baking powder, and salt; add to butter mixture alternately with milk, beginning and ending with flour mixture. Beat at low speed just until blended after each addition. (Batter will be thick.) Place 22 baking cups in 2 (12-cup) muffin pans; spoon 1/4 cup batter into each cup. Bake at 350Â° for 18 to 22 minutes or until a wooden pick inserted in center comes out clean. Remove from pans to wire racks, and cool completely (about 45 minutes). Pipe or spread Cream Cheese Frosting onto cupcakes.