I want to write code to communicate with encoders of different positioning styles (absolute vs. relative). The idea I have is to create a base class that has things common to all encoders. Then there will be two child classes, one for absolute and one for relative. There will then be child classes of that for each brand. Each class will have unique functions to communicate with.
Sketch of hierarchy:
Supposing I had a way to identify each motor by brand and type, how would I programmatically decide what class object to create?

This sounds like an excellent situation for inheritance, as you already hinted, and can be solved pretty quickly that way. I have put together some sample code for you that shows how you could accomplish this.
There is one point you make that I would like to contend:
You mention that each class will have unique functions. I actually recommend exactly the opposite, given every class the same core functions, and then after they are initialized, you never need to worry about which one you actually got, because they all adhere to the same interface. This can greatly simplify your future code as you will not need to ever check which class you are using, and your code will be reusable between different motors without any rewriting, just by changing the motor brand and name.
To answer this question how would I programmatically decide what class object to create? : I recommend a dictionary with brand name and model name tuple as the key, and the appropriately built class definition as the value. If two separate models use the same interface, you can simply map both to the same class definition. I have an example implementation of this below named
MOTOR_ENCODER_LOOKUP.Running the above yields:
Let me know if you have any follow up questions.