The image on tops shows the lens design difference between the EF and RF 35mm lenses. Thanks to the shorter flange distance the RF lens can be made much smaller while still having a superior image quality.
In an interview with DC.watch Canon engineers explained why having a shorter flange distance and large diameter matters. Just like Nikon also Canon claims lenses can be made of higher quality when the diameter is large because less in glass correction is needed.
It’s very interesting to learn from the interview that Canon actually considered to use the EF-M mount. But the smaller diameter wasn’t satisfying to achieve top image quality results. This seems like an indirect critic to Sony too which uses about the same diameter (Emount has 46mm and EOS-M 47mm).
Note: I edited this post and corrected some mistranslated part reported by the readers. Thanks!