What are the default export settings when I choose to upload to YouTube in Final Cut Pro X?
I'm not 100% sure this is the correct settings, but it does seem to be closer to the real thing since YouTube no longer shows the warning when you use these settings.

They key seems to use H.264 with the .mp4 format. The way to choose mp4, is to change the Format from Video and Audio (.mov), to Computer (.mp4):



This uploads cleanly to YouTube with no warnings, and also produces a video that is half the size of the .mov file (200MB instead of 400MB).

If you find yourself wanting to use this solution many times, you might as well create a new destination, Prepare for YouTube:



Note that the resolution settings are not 16:9 in the last screenshot (i.e. they are 4096 x 2160 instead of what is ideal on YouTube for 4K: 3840 x 2160). This means you'll need to manually choose this setting each time in the share screen.

Note: When you try to download the video on YouTube, you might expect it to download the original mp4 you uploaded (200MB), but you'll find that the video that is downloaded is much smaller (18MB). You can therefore not use YouTube as a way to backup your exported mp4. You should still store it on some other medium or service.