how exactly the brain interfaces/controls/disables such automatic muscle reflexes when it needs to?
A: At multiple places within a hierarchical system:
In a simplified way, the Motor cortex is the executor of movement via projections to the brain stem and spinal cord, this is accomplished via excitatory signals to a muscle, the agonist, and inhibitory signals to the antagonist, so in one sense, spinal interneurons would be the answer, since they interface with the motor cortex and alpha motor neurons at the muscle site.
There are also feedback loops all over the motor hierarchy, premotor and supplementary motor cortex regions for instance help plan the movement direction, we don't seem to code a target in the strict sense, but rather a movement direction and then correct via sensory feedback.
The cerebellum projects to premotor, motor cortex and the brainstem, and receives projections from premotor areas, it is involved in stopping and timing movement,the brakes for action if you will.
The circuitry of the Basal Ganglia which loops with premotor and projects to the motor provides the go, no go and graded modulation via inhibition to the motor cortex, which in turn affect less spinal interneurons, so in another sense this circuitry would be responsible.
Can it alter the weighting of inhibition in antagonistic muscles?
Yes, via spinal interneurons (Henshaw cells, Ia inhibitory interneurons and Ib inhibitory interneurons)
As well as 'set the length' for a stretch reflex to target?
Yes, via a the motor,basal ganglia,cerebellum motor hierarchy, although as mentioned, there is no target but rather a direction vector and feedback that tells you when to stop the movement, i.e. you reached your target. ( Higher cognitive areas do seem to have a representation of the target though).
Or does it somehow control both 'with one value'.
Depends on the interneuron, but basically they serve as information relays ( they also convey sensory information )
Where and how exactly does it interject into the feedback loops?
As mentioned there are multiple feedback loops, the brain is not a unit, but a system and as such I would rephrase the question as which subsystems, brain regions, neuronal tracts and neurons create feedback loops in the motor system.
I am trying to understand it more from a programmers pseudocode
I am a software developer myself, so let me try switching hats, this is one scheme:
If all you want is to control agonist/antagonists, tie up 2 or more variables together such that when one goes up, the other goes down, and presumably change 2 effectors ( virtual or real ) and their position relative to each other,
If you want specific control, you would then need to send 2 channels of information and modulate both variables, if you just send one to either one, the other will respond based on the above configuration.