Plants don't contain vitamin B12. Some but not all bacteria living on the surfaces of unwashed plant may contain some B12 but only in very tiny amount, insufficient amount for a human's daily requirement. Only a few certain kinds of bacteria can produce B12. A vegan must eat 50 lbs everyday of unwashed vegetables to get enough B12 for daily requirement.
The plants that real herbivore animals feed on such as grass and vegetables are contaminated with all sorts of bacteria, they may be contaminated with feces. All animals can eat unwashed contaminated plants, all raw without cooking, even the ones contaminated by feces, without getting sick, humans are the only animals CAN get sick or even DIE by eating unwashed contaminated plants.
E-Coli and Salmonella are two most common bacteria found on the surfaces of produce especially leafy vegetables. Most fatal food poisonings are caused by eating contaminated vegetables.
Feces are rich in B12 because of certain bacteria in them, but some of those bacteria are harmful to humans when ingested.
Salmonella produces B12 but this bacteria is dangerous to humans.
If vegans eat raw unwashed vegetables that are contaminated with B12-rich feces, they get very sick and may even die, this is the reason vegans must wash their vegetable cleanly before eating them, but cleaning them may get rid of all bacteria on the vegetables.
This is one of the reason most vegans are deficient in B12.