You can modify the list of arguments in withArguments any way you like, not just appending to the end.
linker.withArguments { args ->
List origArgs = new ArrayList(args)
args.clear()
// do magic to recalcuate the argument list
List newArgs = ["test"]
args.addAll(newArgs)
}
I think this is going to make your build pretty fragile/sensitive to the argument ordering that Gradle produces. I think it would be better if you could avoid circular dependencies (maybe by sub-dividing your library more?).