If Putin's goal is to stop NATO expansion into Ukraine, then the recognition of the Donetsk and Luhansk regions doesn't help much - they are too small to provide a meaningful buffer. Also, there is a risk that the West will use the deployment of Russian troops to those regions as a justification to deploy its troops to protect the rest. Then make double-sure Ukraine becomes a member.
I don't understand what Putin gains from this move. Maybe he didn't have any better options (there's no chance of keeping the West out of the whole of Ukraine), but this move seems to basically force NATO to respond in kind, which is not beneficial to Russia.