"Sofia likes animals, except alligators."
Translation:Sofia ŝatas bestojn, krom aligatoroj.
Why is "aligatoroj" not accusative, since it is theoretically a direct object?
I think it is because "krom" is treated as a preposition and nouns after prepositions don't take the -n ending if there is no direction involved. But I understand your feelings ;)
There's some good information in ReVo about this. As Zubiz said, if krom is treated like a preposition, then you would never see an accusative after it. ReVo mentions a few more-or-less authoritative works on Esperanto usage. My summary of all this is that "krom" is usually treated as a preposition, but is sometimes treated as a conjunction, in which case you will see an accusative after krom.
Click the link and search for krom.
This was really, really useful to me. I actually checked PMEG before answering this but somehow I missed the "Wilhelmon" example. Indeed explanations in ReVo give a better picture of the situation. What I understand is using -n ending is not a serious crime but acceptable although "superfluous" by Bertilo.
Sometime ago I encountered a similar situation related to "po". My knowledge of eo grammar was significantly weaker by then, but my intuition was to use -n ending and it turns out to be that this use is even more commonly encountered than krom situation. Even Duo accepts -n ending to be used with "po", as far as I remember.
A personal question for you: do you use -n ending in those cases?
I am actually advocating the conjunction-like usage of "krom" and similar words, because it can resolve ambiguity. I also like using accusative after "anstataŭ". I am aware of this annoying sentence in the Fundamento "Anstataŭ kafo li donis al ni teon." I definitely would say "kafon" here, neglecting the Fundamento example because to me it makes much more sense.