rustpkg: Search RUST_PATH properly for dependencies, and add a test for recursive dependencies

Closes #8524