Your phone isn't muting itself, it's doing exactly what it's supposed to do - trying to play music through the USB port. That's because the USB port on the RAV4 (along with many vehicles in recent years) is designed to be used for both audio playback and charging.
I can't comment on the RAV4 specifically, but in most vehicles the input source will change as soon as you plug the phone into the USB port. So, preventing this behaviour involves only changing the car's input source back to whatever it was prior to connecting the USB cable.
If that's not happening in your case (some car audio systems don't seem to let go of the input, even though the source has changed), perhaps you can change the audio source on the iPhone. To do this, tap on the down arrow on the right of the Dock Connector label to see what other options you can pick (if any). Plugging in some headphones (assuming you're not using an iPhone 7) will provide that as an option to select.
Otherwise, the assumption is that playing audio through the iPhone's built-in speakers is not required when it's plugged into a dock/external speaker (which is what the builtin USB port is on the RAV4). Your only option to play audio through the builtin speaker is to plug the iPhone into a secondary USB charger (e.g. using the accessory socket of your vehicle).
Your next best option is to just plug in some headphones (although if you have an iPhone 7 you may need a special adapter so you can both charge and use the headphones simultaneously), or connect to Bluetooth headphones.
I was reminded via the comments that you can actually buy cables that are charging only cables. My brother-in-law accidentally bought one of those cables and he could never use it for anything other than charging. So, presumably, such a cable could solve your problem.
In my brother-in-law's case, he purchased his cable from a servo (i.e. a gas station). I mention this only because I'm not sure if that's where you're more likely to come across them.