What's the relationship between UObject and UClass

Yes, UnrealHeaderTool (UH), before compilation os parseing headers in search of all UMACROS() (which are only used for that, in reality they are empty macros that does nothing durring compilation), when it finds those macros it read it specifiers and reads information below it, class/varable/function name, function arguments, general information about the thing below. Based on that and specifiers in macro, UHT generates extra header files (For GENERATED_UCLASS_BODY()) and cpp file which contain registering code, which adds stuff that he find in to reflection system and creates objects for each of them (UClass, UFunction, UProperty), which later can be used to identify them in the code. Most commonly used is UClass as C++ can’t point classes in varable

So in short, yes, UClass is generated for each UObject class with UCLASS() (and if im not mistaken you need to place that macro in UObjects)