Towards compact phase-matched and waveguided nonlinear optics in atomically layered semiconductors