Zest/PHP is a CSS selector engine that Parsoid uses to implement querySelector and related queries to work around bugs / shortcomings in the native PHP-DOM implementation.
Domino/JS also uses zest/JS to implement querySelector.
Zest/PHP should be integrated to Dodo in the same way it is integrated with Domino to implement these DOM methods with adequate performance. Parsoid should then use the Dodo versions of these methods instead of directly calling Zest/PHP.
Again, this may require refactoring Zest to allow it to work with an arbitrary DOM library (see T271728: Migration strategy from DOMDocument to Dodo). Some of the performance hacks in Zest use the PHP xpath library, and might not work without libxml; these need to be benchmarked for performance.