Code under includes/libs should be self-contianed and must not depend on code outside that directory. This is mostly the case, but some unwanted dependencies have crept in, which should be fixed.
Reference: https://www.mediawiki.org/wiki/Library_infrastructure_for_MediaWiki
Code search: https://codesearch.wmcloud.org/search/?q=use+MediaWiki%5C%5C&files=%5Eincludes%2Flibs&excludeFiles=&repos=MediaWiki+core