It is not possible to use that function to determine if the site is a data repository when the site is not already a DataSite instance. And in that case an isinstance() would work too.
If possible that should be done together with T85331 because the current system doesn't allow that a Wikibase repo uses another Wikibase repo (although I'm not sure if that is possible).