Use like this:
$builder->add('company', EntityTreeType::class, [
'class' => YourClassName::class,
'children_method_name' => 'myCustomParentFunctionName', // default to getParent
'parent_method_name' => 'myCustomChildrenFunctionName', // default to getChildren
'entity_method_name' => 'myCiustomEntityMethodName', // default to getName
])