A novel framework for semi-Bayesian radial velocities through template matching