Is it logical to do so? No but it is possible and Apple sanctioned. In fact it was featured at last years WWDC
Those devs aren't going to purchase Apple hardware whether Apple sells them cheeseburgers or not, so its more profitable for Apple to sell them cheeseburgers.
You can, in fact, write an app and publish it to Apple's App Store with it, all from an iPad. I have no idea how much actual uptake this has seen, since I think the capability only came out at the start of the year?
If you teach a class, having a CI build and run the programs, potentially taking screenshots for you to review later could be a pretty good use case, especially for remote home work.
This is a (presumably well-integrated) alternative to CircleCI. There's nothing about this particular product that would make it even remotely relevant for a middle school programming curriculum.
At any rate, what you're asking for already exists — Swift Playgrounds has been around for years, it's specifically tailored for learners, is kid-friendly, and already lets you take the whole journey from your first line of code to publishing on the App Store.
But of course that doesn't add to their monopoly profits :-)
> I can't think of a good reason Apple would want to support developers who want to publish in their (very) walled garden but aren't willing to purchase at least one macOS device