Photonic engineering of surface-emitting terahertz quantum cascade lasers