Mechanically robust waveguide-integration and beam shaping of terahertz quantum cascade lasers