Generating Gremlin bytecode is much easier (and less error prone) than doing direct traversal.addStep() calls. Moreover, the serialization and ultimate translation to a Traversal is handled by GremlinServer (or remote connection).
Gremlin bytecode is in TinkerPop 3.2.2.