Yes it can be it b12 deficiency but you can easily check that. You just do a blood test for vit b12. It is rare to have vitamin B12 deficiency at your age unless you have a problem with your stomach/intestines.
Most probably it is the stress that doing that. You should lower your stress level, exercise, yoga, meditation, etc. If all the above doesn't work, then you should see a mental health professional. Good luck!