I am facing the same issue with a fork of openCV. So far the only solution I found is to first install the packages that depends on the original package and then force reinstall my custom version. In my case I am building a docker image so it is easy to do but it might be way harder or even impossible in some scenarios.
pip install foo-manager
pip --force-reinstall other-foo