I'm not sure if the statement of "we didn't keep trying to expand NATO" is correct. Most of the expansion was a result of requests from former USSR states to join, which was then supported by the US and accepted by other member states. I don't think it's correct to we were trying, when it's more likely that former USSR states were trying to pull NATO toward them.
I also am not sure that war would be avoided if NATO didn't expand. Putin and Russia have made statements that suggest a desire to grow their influence over former USSR countries, and those countries resisted by joining NATO or ousting Russian backed leadership.