Quick fix for gen_java/gen_python in codegen.  I ran into issues with running codegen because the task was trying to access the build graph during its __init__.

Testing Done:
CI passes

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