Yes, vitamin K and the B vitamins—including vitamin B12— are made by certain bacteria. The situation in the human digestive tract needs some further explanation, however.
The nutrients from digested food—including the vitamins—are absorbed in the small intestine. The main functions of this organ are digestion and absorption. Most of the bacteria that release are potentially helpful vitamins for us live in the large intestine, which is located beyond the small one. Some vitamins are absorbed in the large intestine. There is uncertainty about the quantity of vitamins that are absorbed in this location, however.
Absorption of vitamin B12 from food is a particular problem. It requires the presence of a chemical called intrinsic factor, which is made by glands in the stomach lining. The intrinsic factor enables the vitamin to be absorbed in the last part of the small intestine, which is called the ileum.
Vitamin B12 is found in foods from animals but not in those from plants. Vegans who fail to take vitamin B12 supplements can develop serious health problems. This indicates that we don’t absorb enough vitamin B12 from the bacteria in our large intestine to be helpful. People whose stomach doesn’t make enough intrinsic factor can also develop problems if they fail to take supplements.
Obtaining sufficient vitamin K may be less of a problem. It's found in food from plants and to a lesser extent in certain types of food from animals and a few fermented foods. Also, it doesn’t require intrinsic factor to be absorbed. Obtaining a small quantity of the vitamin from the bacteria in our large intestine may be a bonus.
Vitamin K2 exists in different forms. Plants make vitamin K1 or phylloquinone. Leafy green vegetables are a good source of this vitamin. Food from animals contains vitamin K2 or menaquinone, which exists in slightly different forms. Intestinal bacteria also make vitamin K2. Our body can convert vitamin K1 into the form of vitamin K2 that we require.