It's called banding and there is no way to avoid it 100% with any 8bit format such as H.264 on YouTube. Even if you work in 32bpc in AE, eventually the issue wil lcome back when doing the final compression. It's inherent in the underlying computationa math. The only way to minimize it is to disguise it by adding subtle noise. also reconsider your design - large uniformely colored areas are problematic for any compression and will only intensify the perception of artifacts.
These color artifacts started as 8 bit problems that were intensified by compression. Higher data rates help but, as Mylenium said, there's not much you can do about it except add some noise when you're using an 8 bit codec.
Here's the math simplified. Let's look at just the blue channel. You have blue values from 0 to 255 available. let's say your color transition is from a blue value of 50 to a blue value of 60 from left to right. The change is subtle and if the distance between the blue value of 50 and the blue value of 60 is 10 pixels then you'll have a smooth transition. However, if the distance between a blue value of 50 and a blue value of 60 is 200 pixels then you'll have 20 pixels that are 50, then 20 pixels that are 51, then 20 pixels that are 52 and so on. This results in visible banding between the values. Throw in a compression scheme like H.264 and the codec's going to try and group pixels together in as few a color blocks as possible. The lower the data rate, the larger the color blocks. At a very low rate you may end up with just 4 blocks of pixels to cover the value range between 50 and 60 instead of 10. Raise the data rate and throw in multi pass compression and you may end up with 8 blocks of values. Use a lossless compression scheme and you'll end up with all 10.
BTW, AE doesn't do multi pass compression directly unless you load your AE project into the Adobe Media Encoder and do your compression there. After Effects is a Production Pipeline Tool and not a Content Delivery Tool. There is a major difference between the tool. Production Pipeline Tools are specifically designed to maintain quality and retain precise pixel values throughout the production process. Delivery tools are designed to compress in the most efficient way for distribution of content at the lowest possible data rate.
This explanation is very simplified but the information should help you make better rendering and compression decisions.
i added some textures into some of my new official projects and tried to have no flat color. and it solved the problem entirely thanks for the help!