I'm not sure if you understand the difference between a "container" and a "video format" (codec).
From your description it sounds like the application you are using does exactly what you aim for. In both cases you end up with video coded in the H.264 "video format". It is just that the "transport format" is different.
For streaming to Twitch and alike you send H.264 video format over the "RTMP" transport format (over the network). For recording to disk you save H.264 video format inside a "MP4" transport format (a file on disk).
A .mp4 file is the recommended and usual way to store H.264 coded video in a file. There are ways to extract the raw H.264 video format from that file - however the result would be rejected by youtube since it does not come within a meaningful container.
If you think a youtube upload is slow there basically two things I can think of:
a) If it is the upload bandwidth that is the limiting factor here you would have to set a lower coding bit rate for the video on your application. This one results in a lower video quality but would upload to youtube a lot faster.
b) It is the transcoding time it takes youtube to convert your video to their formats. Not much can be done here from your side. Perhaps reducing video resolution may speed up the process. Again losing some video quality.
Quality measurement is not trivial thing and can't be generalised. But it may be that your current settings are way over the top and you could easily reduce the coding bit rate by a half or even more without noticing any decrease in quality. I thinks its up to you to find a good trade-off for your needs.
Again, it looks like your setup is good. It may be that you want to adjust your settings to work around your "problem".