You’re going straight to the element’s name (type name) rather than getting the referenced element itself. If you can get the element from the reference then you’ll be able to get the type and family. You could also try getting the family name directly from the reference element.
You can always use Python to get this information via the API. NestedFamilyTypeReference Members
This thread goes into how to do that: