Russian military doctrine includes nuclear first strike when there's an "existential threat" to Russia, even if that threat is from conventional military attack. If Russia can use nukes against Ukrainian army entering the Russian territory, then for sure it would use them against NATO troops doing the same.
Also, in such a dire situation, Putin and other Russian leaders are crazy enough to use not just tactical nukes but to start full scale nuclear war without any hope of winning, just to "go with a bang".