Use recursive algorithm for build order

Work in progress, I know the tests don't pass ATM.

I was experiencing really odd build order issues, where dependencies were getting built before a project that explicitly depended on them (in this case, bundler getting built before ruby-windows). TBH I'm not sure how the previous algorithm was expected to work so I don't have a regression test right now. I'm running a test build right now and this has solved my problem however.