Project maintainers should have the ability to 'forward' part of the received donation to other projects - without which the project wouldn't have been possible.
Which contributors, which dependency and how much to share - these questions are best answered by the project maintainer(s) - they can forward zero or all the funds and make the process automatic, so when a donation is received, the system automatically redistributes it to other accounts, as configured by the maintainer.
I've worked on a design spec for such a system some time ago: https://github.com/boomhub/design
I'd gladly resume work on it if anyone else feels like this is the good way to go. Just start by creating an Issue :).