The idea is to have the YouTube audio play on your very own internet radio station, and have the Sonos tune to it. Here is the sketch of the solution:
Cast receiver. The "Send to TV" button of the phone's YouTube app uses the DIAL (or Cast Receiver) API to instruct your TV to play the selected YouTube content. The leapcast software (https://github.com/dz0ny/leapcast) emulates a Chromecast device, which understands the DIAL API. Install it on your server, and you will be able to use the Send to TV button to play the video on your server.
Internet radio. Use IceCast2 and Darkice to convert the audio output of your server into an Internet radio station the Sonos system can tune to. Whenever you send a video to your server with the Send to TV button, the radio station will broadcast the audio track of the video.
Monitor. A simple python script (below) monitors the audio output of the server, and instructs the Sonos system to tune to your radio station whenever it detects audio activity (using the SoCo remote control software - https://github.com/SoCo/SoCo).
The full tutorial and monitor script are now hosted on Github: https://github.com/gpothier/sonoscast