You're saying it yourself: use gentoo
. Gentoo is designed for such things.
Or check out Debian's website, find out how to make debian packages, and rebuild your packages, and install them, so they will replace the original. You can get all source code from the package sites at Debians website. But I don't think it's such a good idea... You could easily mess up things.