The reality is that Russia had had NATO countries on its borders (Estonia, Latvia and Lithuania) for years before it invaded Georgia and Ukraine. And two years ago Finland joined as well. Russia did nothing to prevent this.
NATO is a defensive alliance. The only thing it threatens is Russia's imperialism and expansionism.
Russia broke countless agreements where it recognized Ukraine's borders and independence, so Russia's signature is now worthless.
The war could stop tomorrow if Russia stopped the aggression it started. But Putin has consistently made it clear he wants all of Ukraine. Here's a recent example: https://www.reuters.com/world/europe/putin-says-the-whole-uk...
Everyone knows how Russia treats the peoples of lands it conquers: torture, executions, deportations etc. No country could accept these terms. It would amount to national suicide. For this reason Ukrainians have to choice but to keep fighting.