Putin has publicly stated that Crimea is Russias soil and he is worrying that if Ukraine joins NATO and attacks Crimea, Russia would have to fight NATO.
First mistake: Crimea is part of Ukraine, not Russia. How could they venture an attack on their own soil?
Second mistake: NATO is a defence organization. If a NATO member starts a war with a non-NATO country, NATO is not obliged to assist.
How incredibly stupid does Putin think his own people are?
MOSCOW, February 1. /TASS/.
No one in the West has ever thought that if Ukraine is admitted to NATO and ventures an attack on Crimea, Russia will have to be at war with the alliance, Russian President Vladimir Putin said."[Crimea] is Russia’s sovereign territory. The matter is closed for us in this sense. Let us imagine that Ukraine is a NATO member and ventures such a combat operation. Are we supposed to be at war with NATO? Well, has anyone even given a thought to it? It looks like no one has," he said.
https://tass.com/politics/1396273