As people have mentioned, it’s not about saving $, it’s about saving space inside the device which is highly valuable
Lots of dongles are quite high quality. Apples even sounds good, and Moondrop makes a higher-end audiophile one that’s better than basically any built-in jack. There’s a pretty big market for good USB C dongles (less so for Lightning).
if you care a lot about audio quality, you might know that the companies always tried to save $$ but using pretty mediocre DAC’s internally