I can't speak for the licensing costs of Android Auto or Apple CarPlay, I have no idea what they are.
But I do work in the automotive industry as an engineer. The sentiment is very much that it's about getting customer subscriptions and customer data, to build recurring revenue streams that wouldn't be possible if people are able to just use their phone and its apps on their infotainment display.
GM at least I know is sticking to Android Automotive, which is built by Google and they pay for anyway. Android Auto and Carplay are just additional functionality built on top of Android Automotive (the naming is bad - Android Automotive is the Google Android-based OS for car displays, Android Auto is the projection tech/api), they're quite literally removing existing features on a product they're already paying for.
I highly doubt Google is giving them a huge discount to cut those features, and if they are getting any it's dwarfed by how much they want to make through subscription services to use your car.