(PUP-4178) Fix defined() to report non realizes class as undefined
Before this, the new 4.x function would report that non included
classes were defined. This problem does not exist in the 3x version
since class references are transformed to Resource references.
The code path for Class was simply never exercised, abut when moved to
4.x. the faulty check if class existed was used instead of a check if it
was defined (i.e. realized).
This changes the 4.x function to lookup the class resouce instead of the
class definition.