Dee Kryvenko still sounds like you are overthinking this.
there is certain state the loader library needs to read (example Git data like repo path/branch etc)
is not (mutable) state, it is information which you can pass e.g. using withEnv.
I can't embed too much into the DSL string itself due to infamous "Method code too large".
You cannot too much into a single method. You can define as many methods as you like so long as each is a reasonable size.
Anyway, it is hard to follow what you are really trying to accomplish, or how you thought you should accomplish it, but this is all a topic for the users’ list or Discourse or Stack Overflow or something. So far as @Field is concerned, the status remains: this sounds like a bug in a corner case; it is unlikely anyone is going to work on it due to the effort and the risk of other regressions.