Russia's original plan was to take Kiev in 3 days and install a pliant government that would rule out NATO membership. Russia probably would also have annexed Donetsk and Luhansk (which were already under the control of pro-Russian rebels, backed by Russia), or at least have forced the Ukrainian government to grant them autonomy.
However, after the initial plan of a quick war failed, Putin had to show something for the war, and annexed the occupied territories (beyond Donetsk and Luhansk).
There's no real doubt that possible Ukrainian NATO membership (and short of that, its ever closer de facto integration with NATO) were primary motivating factors for the Russian decision to invade.