I think I understand your post but it isn't entirely clear to me.
Why or what is causing your device to use the built-in speaker? Does this happen when calls come in, when alarms go off, notifications, what uses the phone's speakers instead of broadcasting through the car speakers?
Have you checked the settings for Android Auto and your car's system to see if there is a setting that can be changed so that, whatever is playing through your phone's speaker, will play through the car speakers?
You mention it as somewhat of a side note in your post that this is happening when the phone speakers are used but does this happen other times? Since you are connecting via USB have you checked your USB cable for damage or tried a different cable to rule out a bad connection?
There is actually an Android Auto forum here at AC where other users can see your question and may even know the answer. In order to give the best advice more information may be needed. To reply to this thread and see other forums please register an account. This link will help you do that...
https://forums.androidcentral.com/ask-question/409154-join-android-central-community-new-post.html
In the meantime I will request that this thread be posted in the Android Auto threads.
Moderators will you please move this?