Yanmar engines are 'shut down' by lowering the engine speed / rpm to that lower than what the engine can normally idle.
Some use a simply control cable, some use an electric solenoid ... and all allow the normal running idle position (on the control cams and cranks) to be momentarily 'depressed' below 'idle' speed.
Simple speak: your engine's 'idle speed' control needs to be readjusted, so that when you pull the cable or push the stop button the engine's rpm drops to that which will stall the engine. Your engine is probably 'idling' at too great a speed and needs to be 'lowered'.