Then the explanation for the flour is that the water and flour interact to produce gluten that then gives the cake its structure.
Your confusion is well-founded, because
gluten is required to form the structure of cake
is too strong of a premise.
Gluten can be a primary contributor to the structure of a cake, as in a wacky cake, but it is not required.
This answer limits its scope to cakes and does not discuss other forms of gluten-free baking (bread, pies, etc). Gluten is a significant contributor to the structure of wheat products including breads, croissants, and some types of pie crusts and pastries.
Non-Gluten Sources of Structure for Cakes
On Food and Cooking by Harold McGee is a well-regarded reference. In its section on cakes, it does not describe gluten formation as necessary or desirable. I consider this weak evidence that "conventional wisdom" does not count gluten as a major structural contributor in cakes.
As noted on page 554 of the second edition of On Food and Cooking,
A cake's structure is created mainly by flour starch and by egg proteins.
The omission of gluten as a contributor to structure is especially notable given that the next sentence mentions how other ingredients interfere with gluten.
The tender ... texture comes from gas bubbles ... and from the sugar and fat, which interfere with gluten formation and egg protein coagulation, and interrupt the network of gelated starch
Angel Food Cake
As noted in this recipe for angel food cake by Stella Parks, egg white can provide sufficient structure for a cake.
... angel food cake is so high in protein from egg whites, it has enough strength to stand on its own ... With that kind of underlying structure, all angel food cake really needs is enough starch to keep its moisture in check
Note that the motivation behind removing gluten in this recipe is specifically avoiding the additional structure gluten provides:
angel food cake toughens up like shoe leather in the presence of gluten
Personal Example: Gluten-Free and Egg-Free Brownie Recipe Adaptation
In my personal experience with a few brownie recipes, protein from eggs provide a considerable amount of structure; omitting eggs without adding protein produces dramatically different results.
The most rigorous experiments that I have performed were attempts to remove gluten and replace eggs in this recipe for brownies by Alice Medrich.
In my earliest experiments adapting Medrich's recipe, I tried replacing wheat flour with an equal amount (by mass) of rice flour. This produced a result that was recognizably a brownie.
However, also replacing eggs with binders and emulsifiers without protein (in my trials, a mix of water, lecithin, fiber, and starch) produces a sticky, caramel-like mass that separates from a significant amount of oil. This outcome was observed when using rice flour and gluten-free flour with xantham gum added.1
These two results are evidence that, in this recipe, eggs are sufficient for structure even without gluten.
Another recipe by Dandelion Chocolate also appears to work fine with AP flour replaced by an equal amount of rice flour.
1 Correction: A previous version of this answer reported similar results with AP flour, and inferred from that result that the procedure outlined in Medrich's recipe made the gluten content of the flour irrelevant. In light of newer experiments that showed that simply adding enough starch and enough gluten in place of the AP flour produces brownie-like results, the inference is incorrect.
Whey protein isolate, mixed with psyllium and starch for binding, baking soda for lift, and water for hydration, is the best substitute for eggs I tried so far; it produces a crumb very similar to that produced when using eggs.
Adding more starch than called for in Medritch's original recipe (e.g. increasing flour used from 65g AP flour to 100g rice flour, then adding another 10g of tapioca starch) appears to have a stabilizing effect.
Mucilage (in the form of hydrated xantham gum, psyllium, or flax) may contribute to structure as part of their role in egg replacements.