Perform our own more specific version check for Sphinx

This is an alternative to #1812.