The sentence Only when that is done do we have a class from which we can create objects features one of the cases in which the subject and the verb are inverted in English.
Swan in Practical English Usage has a section with the title (Inversion) after negative and restrictive expressions (p280). He writes:
If a negative adverb or adverbial expression is put at the beginning
of a clause for emphasis, it is usually followed by auxiliary verb +
subject. These structures are mostly rather formal.
- Under no circumstances can we cash cheques.
- At no time was the President aware of what was happening.
Inversion is also used after restrictive words like hardly (in BrE), seldom, rarely, little and never, and after only + time expression. This is formal or literary.
- Only then did I understand what she meant.
- Only after her death was I able to appreciate her.
- Not only did we lose our money, but we were nearly killed.
As non-inversion alternatives to your sentence you could write :
- It is not until that is done that we have a class from which we can create objects.
- We have a class from which we can create objects only after that is done.