Is there a way to check from command line whether
tex and other commands belong to MiKTeX or some other distribution (I want to only
(require 'tex-mik) in Emacs initialization if it's needed)?
You can use
pdflatex for that. If you call
pdflatex --version you get which distribution is used, in my case TeX Live:
pdfTeX 3.14159265-2.6-1.40.15 (TeX Live 2014/W32TeX)
kpathsea version 6.2.0
Copyright 2014 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Or you can use the
latex command, which works the same.