I have a bit of a different perspective. Sure, Duolingo is suboptimal and won't teach you a language on its own, but I'd say that language classes themselves is no better.
Specifically, I consider the fundamental missing piece to allow achieving language intermediacy or fluency to be confidence and sporadic language use, and you have to be lucky for a language class to give you this. Hearing about grammar and having Q&As is nice, but that teaches language theory, not fluency. Trying to converse about a specific topic with other non-fluent and disinterested individuals does not teach fluency, and not every conversation will be with the teacher - the only (hopefully) fluent person in the room - and even if the option is present, some might be uncomfortable with it.
On the other hand, if you have achieved some confidence and means to exercise the language - which you don't acquire from a language class - then I'd consider Duolingo to be a decent vocab and sentence exercise tool. Some cultures rely on flashcard approaches to teach their written language to locals, so it's not that silly. Duolingo does also have reading and listening comprehension tests.
Furthermore, I'd argue that newer LLM-based exercises might end up being superior to both traditional "pool of random non-fluent people" language classes and duolingo's current model, and arguably the task that large language models are most suited for.
(Note that Duolingo classes differ a lot between languages - my experience is from Mandarin.)