As rossdavidh mentioned, a country may not join NATO while at war even if one calls it a military operation. If either or both countries joined while at war then all NATO countries would be obligated to join in, thus solidifying a full scale WW3.
So I think your question is really how long would it take for WW3 to end and I guess that depends on tactics used. Probably less than a few years and I have no idea whom or what would remain.
I do get your point and I like the idea in theory but neither country is willing at this point to compromise or give up what they perceive as their territory. They have even stopped pretending to have peace talks. In my opinion the only way peace talks might resume would be for all countries to stop providing resources to Ukraine and Russia.