The D&D is as much built into the classes and spells as anything else. So, yes, creating new classes and a different magic system is probably necessary. That is why I don't think Dark Sun and Ravenloft count as "not D&D Fantasy" -- the player options are still clearly and strongly in the D&D Fantasy realm, even if the setting has gotten a coat of paint.
This is why the question is a valid one, IMO. In order to fully excise the D&D Fantasy, you have to eliminate and/or change some pretty central features of D&D. Can you do that and still be D&D? If the classes are Knight, Lady and Squire, is that D&D? If the magic system is limited to Alchemy, is that D&D?
Those questions are what makes it an interesting discussion.
It certainly can. I've certainly had some interesting
'if you can't systematically define Jazz music (in a way that doesn't exclude something you know to be Jazz), how do you know when something is experimental Jazz, and when it is a new genre?' style discussions. It also can devolve into a selective-True-Scotsman-esque
'this is D&D and without it it can't be D&D but that other thing is just something you always see with D&D but can be jettisoned' head-butting.
The folks in the thread asserting "Of course. What a dumb question!" (not you) are missing the point, I think.
I think trying to declare what the point is rather than successfully argue for one is not a winning strategy. You asked, in effect,
'can it be done?', and people are responding,
'people already are.' So they are answering the question. This seems like a perfect jumping-off point for the polish or nuance you actually hope to get from the discussion. It would be a great time to respond with (example) 'but are those still D&D? And if so, why when d20
Traveller or the like isn't?' or some similar engagement.
I don't have those on hand and I can't recall if they expected you still have D&D clerics, rangers and magic-users (and spells) pretty much per the PHB in them.
Honestly, most expected you would just play fighters and thieves. If another class was even allowed, is was highly neutered.
I think in some you could play clerics and magic users, but they couldn't do much. In others, you explicitly couldn't be any spellcasters.
To open it up to the extreme examples, in the
Vikings one, IIRC, you can't play as clerics or magic users. In then in the BECMI setting
Hollow World, you can play as all the classes, but there are massive restrictions on spells you can cast, and what arms and armor various cultures can use. I think that covers a pretty wide swath of heavy and light re-building of the system.