It's because Putin's ego, and he is willing to put everything in line here just to win the war. As someone said, no one really wins here, it's brother to brother and yet Putin didn't think about the consequences. For him Ukraine should be annex by Russia and they don't want NATO or any other countries in the West ally with Ukraine. US and EU quickly imposes sanctions against the country in response to his attacks. As for the stock markets, yeah, it's obviously any country that is involve will suffer.
Here the possibility of Ukraine's accession to NATO is not of such decisive importance. Putin wanted to unite the former republics of the USSR under his control. But he can't say it directly. Therefore, a far-fetched version was put into play that if Ukraine joins NATO, it will be a direct threat to Russia, since NATO's borders will come closer to Russia. However, Latvia, Lithuania and Estonia are already members of NATO and border Russia. Putin specifically twists the history of Russia and the history of Ukraine.
On the territory of Ukraine in the ninth century a powerful state was formed - Kievan Rus with a center in Kiev. The Russian tribe also lived on this territory. Therefore, the name Russia comes from a word that has Ukrainian roots.
Only the Moscow Tsar Peter the Great at the turn of the 16th - 17th centuries introduced the name "Russia", which was previously called Muscovy. By the way, the first mention of Moscow was in 1147, when the Rostov-Suzdal prince Yuri Dolgoruky, one of the princes of the already decaying Kievan Rus, invited another prince Svyatoslav Olgovich to his village of Mokva (then Moscow was still called Mokva). Therefore, Ukraine can now present territorial claims to Putin and claim territories, including Moscow. These are the original territories of Kievan Rus.
Putin raves about greatness, including the greatness of Russia, and for this he needs to have Ukraine in its composition and claim the former greatness of this state as the history of Russia, not Ukraine.