Vietnam is serious about holding off China in the South China Sea. And Russia is not shy about providing these weapons despite their sometimes friendly relations (which is really a form of appeasement by Russia in the face of the conventional power imbalance in the Far East) with China:
Vietnam will soon have a credible naval deterrent to China in the South China Sea in the form of Kilo-class submarines from Russia, which experts say could make Beijing think twice before pushing its much smaller neighbor around in disputed waters.
Vietnam has 2 now and will eventually have 6. If Vietnam manages to keep a third at sea, that means all this fuss is for 2 subs capable of shooting at the Chinese in time of war. Unless Vietnam builds hardened shelters for the 4 subs undergoing maintenance in port, what is at sea at the start of the war is what Vietnam will have to fight the war, assuming China strikes the ports where the subs are sitting nice and vulnerable.
And if Russia is willing to sell boats to Vietnam whose only possible foe is China, why shouldn't Russia sell boats to Taiwan, which really needs the capabilities that is being touted for Vietnam in the face of China's military power and aggressive use of that power?