SpecialWikibaseQueryPage is abusing inheritance badly and is violating the SRP. It has been identified as one of the more problematic pieces of code in Wikibase. QueryPage itself also violates the SRP rather clearly. Query construction and output formatting belong to different actors. Plus if one derives from it, you'll again have inheritance for code reuse. And that is keeping quit about the problems all special pages have since the special page system is badly designed.
Unfortunately we currently have to deal with this legacy API, and thus have to create a special page. Creating a direct derivative from SpecialPage itself that just delegates to objects of which we can control the lifecycle is one way to minimize dependencies on this legacy API and to mitigate the problems it creates.
Jeroen De Dauwhttp://www.bn2vs.com
Don't panic. Don't be evil.