How to override/disable python build hooks?

Context

Building some python38 packages fail due to sphinx-7.2.6 not supported for interpreter python3.8

The patch

I try to patch it by overriding the hook, however, even using overlays, I cannot get the hook to be overridden.
What is missing on the overlay to actually override the hook?
There is an alternative flag to disable the hook?

Example

Here is a ready to use example using flakes

Maybe pythonPackagesExtensions?

pythonPackagesExtensions = pkgs.pythonPackagesExtensions ++ [ (_: pythonPackages: {
  sphinxHook = pythonPackages.toPythonModule pkgs.emptyDirectory;
}) ];

I think you’re encountering this: https://github.com/NixOS/nixpkgs/blob/ee6092b5c877cddf5425909206125baff6e5e50c/pkgs/development/python-modules/sphinx/default.nix#L42

Ha, indeed, and here I thought “sphinxHook” was actually the name of some Python package. So circumventing that guard could look something like:

pythonPackagesExtensions = stable.pythonPackagesExtensions ++ [ (_: pythonPackages: {
  sphinx = pythonPackages.sphinx.overrideAttrs (attrs: {
    disabled = false;
  });
}) ];

Of course if you actually try to use the resulting python38Packages.sphinx you immediately encounter identical obstacles from its dependencies.