I have an iphone and use carplay but i think it works the same way in both systems.
If my phone is connected by Bluetooth (no cables), then i can play music, hear google maps directions and take calls through the car speakers. That is not apple carplay or android auto, that’s just Bluetooth compatibility between the mazda system and the phone.
When i connect my phone with a cable, then i can start and use apple carplay (or android auto), this is when my phone apps appears on screen and i can view the google map, view spotify or google music, and make calls through the phone interface. But my iphone does not use Bluetooth in this mode, all the communication to the car goes through the cable.
Both achieve a similar results, but android auto you can view and select your app and view the map on the screen. With Bluetooth you get the audio but you cannot view your phones app.
When you start the car, Bluetooth is on by default until you connect your phone to the car by usb cable. But mazda Bluetooth has a hard time finding Bluetooth connection if it doesn’t find your phone soon after you start the vehicle. (For example if Bluetooth is off on my phone when i get in the car and turn it on mid-drive, it won’t necessarily be able to connect to the car mid drive).
My guess is that the Bluetooth issue is just mixing stuff up and the result of your bad connection. I think your phone is doing this:
1. You connect your phone to Android auto with the cable.
2. Your cable lose connection disconnecting android auto
3. The car tries to switch to Bluetooth connection since your phone is not plugged in.
4. But it fails the Bluetooth connection process because it has been a while since the car has been started.
You can test the Bluetooth connection by not plugging your phone at all the next time you go for a drive. I bet that if it Bluetooth is connected when you start the car, that your Bluetooth will work fine for the entire drive.
If you fix your physical connection problem i think your Bluetooth will be fine.
That is what i think based on how you explained your symptoms, but i might be off because it is confusing when talking about Bluetooth and android auto.
It could be a bad usb connector, but as you said, try it with a different phone and also make sure you plug in to the correct usb port first and see if it works well.