Cakes can last much longer, some even improving with age (fruit cake).
This is due to primarily to advances in technology (more reliable ovens, manufacture/availability of food molds) and ingredient availability (refined sugar). When removed the icing cooled quickly to form a hard, glossy [ice-like] covering.At that time cake hoops--round molds for shaping cakes that were placed on flat baking trays--were popular. Many cakes made at this time still contained dried fruits (raisins, currants, citrons).It was not until the middle of the 19th century that cake as we know it today (made with extra refined white flour and baking powder instead of yeast) arrived on the scene. The Cassell's New Universal Cookery Book [London, 1894] contains a recipe for layer cake, American (p. Butter-cream frostings (using butter, cream, confectioners [powdered] sugar and flavorings) began replacing traditional boiled icings in first few decades 20th century.In France, Antonin Careme [1784-1833] is considered THE premier historic chef of the modern pastry/cake world.
When tortes are multilayerd and fancifully decorated they are closer to gateaux EXCEPT for the fact they can last quite nicely for several days.
Cake & gateau: definitions & examples "Cakes and gateaux.