I don't think committing against a NATO membership of Ukraine would affect the current conflict. Ukraine was not close to joining NATO before Russia attacked, and NATO was already clear that it cannot join as long as Crimea is disputed. I think if Ukraine can survive this war, it needs to join NATO as soon as possible afterwards, even if that means surrendering Crimea, Donbas, and whatever else Russia may claim.
Russia is the best recruiter NATO could wish for. NATO want Finland and Sweden to join and public opinion was strongly against until the war. I'm a Swedish citizen myself and have gone from "absolutely not" to "it sucks but maybe we have to" on the question of NATO membership. It's the lesser of three evils. The two more evil options being becoming Russian territory (or at least a vassal), and making our own nuclear weapons. Maybe in the future, the EU may be an alternative to NATO, or Russia may become a better neighbor. But today, in 2022, I don't see any better alternative. That said, NATO's war crimes should also be condemned and Sweden should definitely not participate in any military interventions outside of what Article 5 requires.