This question is beautiful and the answer is critical, crucial and so far-reaching.
At first, I will mention that every participant of the minyan is equally responsible for this minyan, and when the first one leaves knowing that the other one is leaving as well, it is the first one's responsibility as well to make sure there should be a minyan after the second one's taking leave.
Therefore the first one gained nothing by leaving first, for his taking leave was without a reasonable assumption that there is going to be minyan until the end of the davening.
(This is beside perhaps doing lifnei eveir as well as without him leaving the second one would not have transgressed it.)
Now I would like to point out something which is so rooted in the essence of Torah life.
The Mishnah in Avot (perek 5' 13') says there are four levels in the attribute of Tzedakah. One of them is one who wishes to give Tzedakah himself but does not wish others to follow suit for one of two reasons. 1) He does not wish that others also partake in Olam Habah and does not want others to have a Shem Tov. 2) He wants the poor to stay relatively poor and not suddenly climb up to his ranks.
The Mishnah continues with another level in Tzedakah and that is one who wishes that others give and get the reward and help the poor but also wants it not to be at the expense of his wallet.
The Meforshim all point out that these two people although the Mishnah categorizes both them as possessing an ayin ra'ah they take on different meanings as explained above and both display a bad midah which the other one does not.
The Tiferes Yisroel in reference to the one who wishes he were the only one to give Tzedakah that this is an Avon Pelli meaning a harrowing and atrocious sin. Whereas on the next he does not stick on such language.
These words shout "it is far worse to wish on to others not to be righteous than not being righteous yourself".(When discussing a real transgression as Chilul Shabbos it may be different and needs to be thought as that which the punishment went to the one who did the transgressor rather than the one who wanted and enabled him to transgress does not have to mean that it is greater.)
Now the one who is leaving first leaving the dirty work for the other fellow so that he is the good guy with the clean slate does not remain with a clean slate and would be even worse than the last one to leave.
In other words, letting the other be the class clown will leave you being the clown up there and remember the shame up there is eternal.