It keeps the modrons from doing things contrary to their instructions
But instructions are not infallible!
In the general description of Modron's in the MM:
Absolute Law and Order. Under the direction of their leader, Primus, modrons increase order in the multiverse in accordance with laws beyond the comprehension of mortal minds. Their own minds are networked in a hierarchal pyramid, in which each modron receives commands from superiors and delegates orders to underlings. A modron carries out commands with total obedience, utmost efficiency, and an absence of morality or ego.
This puts a greater burden on the caster to make things like suggestion and command work.
An example would be if a a modron was told to guard a door. If this was a normal being you could suggest falling asleep, the door is moved, or so forth. But these would all be contrary to the instruction. It knows where the door is, it cannot move, it cannot be watched if the modron is asleep, etc.
But I could suggest, "Guard the door from the other side."
That is still well within the parameters of guarding the door. So it could still obey the suggestion by opening the door, walking through, and standing on the other side of the door.
Dominate Monster would work similarly. You cannot make them do anything contrary to their programming such as attacking another modron. However you could say, "That modron to the west of you has turned rogue. Subdue it so that it may be reprogrammed."
This means there should not be a blanket statement of "immunity to charmed and frightened". The caster just has to work harder to make it stick.