To me things are quite simple:
First off, the Machines' faction is not a monolithic block sharing perfectly a single unique value system. Otherwise, the Oracle and the Architect wouldn't even have had those cool conversations, showing their differences.
Second, it has been shown. Not only the Agent Smith which became a "virus", but lots of other programs got "corrupted" (the Wraiths Twins, etc.). Nothing ssays that those kinds of corruptions started only AFTER the Matrix was established. Rogue programs could have been there all along. In fact, maybe it was such Rogue programs that even started off the Human-Robots conflictd in the first place? After all, why would monolithc built to be slaves robots macde to serve down to the way their thought program works would EVER rebel, unless at least one of them went "corrupted" and Rogue in the first place?
So, the Machines society might have tons of viewpoints in it. But to keep things simple for our simpple human brains, let's go with two big ones (which donm't even need a binary distribution "each machien is either of this group or of that group" there may be a lot more or even some contradictory overlaps as in when you have two contradictory opinions and are weighting your options with some amount of doubt on which one is the best choice):
Some machines just want the end to the war, and live as equals to humans. Those want the signed agreement and intend to fully respect it. Ler's call those machines the "Equalists".
Some other machines might not thrust the humans enough and want to wipe all of humanity, but they would still find advantage in a signed agreement. Let's call those the "Purists". They would want the treaty signed for the following reasons:
a) Some % of all humans will keep on respecting the full surrender treaty even after the machines wiped the leaders and New York. In order words: this signing would make their intent of getting rid of humanity easier. Even if it is just 0.1% better, its still "better" so why not?
b) Some % of humans would respect a big show of force a bit more (or fall into despair and hopelessness a bit more) if it is demontrated that the humans essentially gave the machines the legal right to do it. Not moral at all, sure. But past human history has shown often enough that a conqueror can ddecide to kill off the surrenderering leaders anyway. Heck some leaders might surrender knowing fulll werlll they're dooomed to die no matter what, but attempt to save their population by doing so. Again even it it is just 1% better, it's better.
c) Crushing the humans but WITHOUT the signing, the machines could have guessed that the odds of the humans just stalling for time to later renege on the agreement, and rally for a counterattac, might vae been high, while crushiign WITH the signing, the little remaining humanity would nssteand tend more to just lose all hope. Meaning, an easier job to control things for the machines. So even if they fully did intend to nuke, the signing costs them NOTHING but will still help them a little bit to manipulate human minds and will to fight back later on.
d) And probably the most important factor of all: the machines sides probably involved a lot of internal arguing that the humans never saw the color of. Maybe the "collective" of all Machines then "votes" somehow to reach a combined "middle ground". Neither sides could achieve "total victory" of it's intents and thus large concessions had to be made to the other side and therefore the final Machine behavior was a kind of "middle point":
- Yes to greatly reduce humanity's remaining numbers and organisation and power.
- No to actually wiping them all out.
- Yes to needing to first get a solid "legal" ground to better justify to the "Equalits" that the "Purists" are allowed to basically commiting a genocide.
To me their behavior is very logical, but them isstakec is thinking that they have one leqader making alll the decisions, like for humans. Their decisions might be muuch more like how the BitCoins protocols decides which transactions on the ledger get approved as "real" and which ones are rejected: it's a consensus of the entire network. Each node might have a different evaluation of the situation, and the final evaluation is determined by minimizing the "stress". Think a big net made up of springs. Each side just pulls as hard it can its way. The entire net however just quickly reaches a state of equilibrium where all springs get pulled both ways more or less with equal strength, something that takes into account all of those forces, yet is not ending up going in the direction of any side, but has it's own dynamics.
Basically, no Machine faction got it's way 100%.
It's like if a bosss thinks paying you 20$/hour is way too much and offers his employees only 10$ an hour. And employees think 20$ an hour is too puny and want 30$ an hour instead.
In a human society, you'd have strikes, scabs, the works. then evenntually the government steps in and say hey i6t's going to ber 20$ an hour, leaving both sides unsatisfied, but at least business can start again and people have work again.
In the Machines world, maybe their internal protocols just force them to rigidly accept that middle ground mediation by the overseeing "the Deus Ex" program. Who knows how many years and CPU cycles the various machines debated amongst themselves before reaching their decision.
Basically, we simply have to not see the machines as a single monolithic "ant farm" intelligence, but as a complex neural network of some kind. Some parts of it might scream "go left!" and some other parts of it might scream "go right!" making the entire system as a whole decide to go straight.
To me that scene made perfect (albeit quite horrible) sense.