I also think it's harsh. They are never going to learn if you don't teach them, side by side. I was preparing full meals for my family by 10yo. At 8yo, my brothers and dad were asking me to bake cookies b/c they didn't like my mom's. My 8yo turned on the oven for me tonight when I had my hands full. My 10yo is turning out to be an excellent cook. She has Asperger's and makes macaroni and cheese and ramen noodles independently. They know they are not to cook without permission or without a grown up in the house and we've never had an issue. 8yo still doesn't do any major cooking, but I imagine by the time she's 10, she'll make a mean pot of spaghetti, too.
I would have baked the cake, but not allowed them to have any of it, and I certainly would not have thrown out perfectly good food. If they sneaked anything, then there would be heck to pay in way of cash damages (mine have jobs aside from regular household chores that earn them money), revoked privileges, or lots of time sitting on a very lonely, quiet bed (no TV, no radio, no music, no books, S-I-T). The other thing I've done with my now 18yo bipolar is to have her shadow me. She had to follow me everywhere I went, except the bathroom where she had to wait right outside the door. You can't be trusted, you're going to stay in my presence for awhile until you realize the importance of being trusted. BTW, this was NOT cruel and unusual punishment and was actually suggested by DD's psychiatrist.
I'm thinking there may be a lot of

and disrespect going on behind your back and you need to nip that in the bud before the hormones are in full swing. I'm very matter-of-fact about it and I never make a threat I will not follow through on. After 21 years of child-rearing, my kids know that I mean business b/c I've meant business each and every time. On the flip side, our rules are very fair and are in place for a reason that is made clear to DDs. And, those rules evolve as the children grow. 8yo is not allowed to attempt ramen noodles alone yet, but she certainly helps with close supervision. My DH is very Mr. Monk-ish, the kids call him Mr. Safety Man, but even he understands the need for them to learn to manage tools, household appliances, etc. With proper supervision, they will learn and, it's a lot of fun cooking together. Your kids may see it as an arbitrary rule that doesn't make sense, and when you think about it, a 10yo is fully capable of turning on an oven without incident, so they don't see what the big deal is (and, really, it isn't). Putting the cakes in and out is a whole other ball of wax that they CAN see should be an issue, but not just pushing some buttons.
BTW, whenever I've done a Mommy-Mess-Up, I apologize to my kids, let them know that even adults make mistakes, and ask them to forgive me. Those are some of the best hugs in the world.