Comical note, the USSR were also committed to helping the Afghans fight insurgents until they weren't. So it's not like Russia's patience with losing is any better than the wests (technically it's worse as they pulled out of Afghan faster).It's easy for politicians to say their support is unwavering, but it's just as easy for that support to dry up in practice. We were committed to helping the Afghans, until we weren't.
One thing that Ukraine has in it's favour is the sunk cost fallacy, while a lot of stuff had been donated to Ukraine there has also been a lot of stuff sold to Ukraine on contract which will require future payment. Now say the west cut support tomorrow and Russia rolls over the country and takes Kiev, do we think the Kremlin will honour those contracts? (obviously it's rhetorical). The western military complex now has a vested financial interest in Ukraine winning, and that's good for Ukraine.