I think if Russia backs them into fully rejecting all security agreements with the West as part of a settlement, they're just in for a takeover by other means, once Russia has its near-term concerns addressed by the peace settlement and can afford to sit back and wait. I think the most likely way out of that (assuming Ukraine achieves one) is a novel arrangement of some kind, more likely with with the EU than NATO, or (waaaay less likely) a new bloc & mutual defense agreement with Sweden and Finland.
Neither is possible. Ukraine does not control its borders so can't join NATO and is not economically viable enough to enter EU. And under that scenario trying to take Crimea starts a world war between Russia and NATO.
Ukraine joining NATO is just not ever going to be allowed to happen.
I believe a lot will depend on the outcome of this war as well as its ramifications for Putin's grip on power. Ukraine has so far defied all the odds and I wouldn't bet against them at this point. If given a bloody enough nose Russia may not be in a position to never allow NATO membership to happen.