Add non-closure injection methods to BuildGraph

This came up for optimizing an internal implementation of WhatChanged.

Testing Done:
CI passes

Reviewed at https://rbcommons.com/s/twitter/r/399/