In T283354 a new abstraction was created to have a clearer boundary between MediaWiki and Wikibase. This abstraction should now be used in all places that are currently using ILBFactory or ILoadBalancer directly.
The child tasks of this task should cover almost every usage in Wikibase. Some places might require some more refactoring or limited extending of the new DbDomain class. Tickets for the remaining usages should be created once the current tickets are mostly implemented and a path forward is more clear.
We may want to consider adding another ticket for creating a test that asserts that LBFactory etc. is not used outside these services. For comparison see the Forbidden Client/Repo usage tests. => T286209: Create a tests to prevent unexpected usage of ILoadBalancer and ILBFactory instances in Wikibase
⇉ More or less all usage of load balancer and load balancer factories except usage in the services for the new DbDomain factories should be refactored away: https://codesearch.wmcloud.org/extensions/?q=getDBLoadBalancer&i=nope&files=&excludeFiles=tests&repos=Extension:Wikibase