A flat cake is rarely about the recipe. It is almost always about what happened to the leavening agent before or during baking. Baking powder and baking soda both begin reacting the moment they contact moisture and acid, which means delay between mixing and baking costs you lift.
Most home bakers underestimate how quickly this window closes. Once a batter with baking powder is mixed, the first reaction has already started. Leaving it on the bench while you preheat the oven, or while you grease the tin, loses a measurable portion of the gas that should be expanding in the oven.
Old leavening agents and why they fail silently
Baking powder older than 9 months often tests fine in isolation but performs poorly under the heat and moisture conditions of a real batter. The test most people use, dropping it into hot water, does not replicate oven conditions accurately. Dating your tins and replacing them on a fixed schedule is more reliable than testing.
Baking soda requires an acid in the batter to activate. If a recipe calls for buttermilk and you substitute regular milk, you remove that acid source. The soda sits inert and the cake does not rise evenly. Substitutions in leavening chemistry are not interchangeable without adjusting the full formula.