Yes, the action economy would work as you describe. Note that the ability to automatically counter requires the counterspell to be cast at a level equal to or higher than the spell being countered.
So if Mage #2 counterspell using a third level slot, they will need to make an Appropriate Ability Check if Mage #1's spell is say, cast using a 5th level slot. (per the description for counterspell, the DC equals 10 + the spell’s level.)
Similarly, Mage #2 could counter using a 7th level slot, and Mage #1 would have to use an equally powered counterspell or face an Ability check himself. So the counterings are not necessarily automatic.
Note, there is a special case at the highest levels of spellcasting. If two spellcasters are in opposition, and both can cast 9th level spells, then the countering mage can be certain that their counterspell will be successful, buy countering using a 9th level slot, even if the initiating wizard uses a 9th level spell. Countering at equal level slots is an automatic success. However, in this singular case the initiating spellcaster has no further 9th level slots to counter the counter, and must resort to an 8th level or lower slot, requiring an Ability Check.
For reference, the action economy of counterspell (and reactions to reactions in general) is clarified in the Compendium.
Can you cast a reaction spell on your turn? You sure can! Here’s a common way for it to happen: Cornelius the wizard is casting fireball
on his turn, and his foe casts counterspell on him. Cornelius also has
counterspell prepared, so he uses his reaction to cast it and break
his foe’s counterspell before it can stop fireball.
In summary, neither casting of counterspell is necessarily automatic. You cannot ensure that your spells are uncounterable.
Note: this question was later edited to add the bit about "as long as they have slots to cast counterspell at a level equal to their opponent’s". I have left the first part of my answer intact for clarity and future reference by users seeking clarity, but added in the case where this would not be possible.