Probably a bit of both. Stations change personnel every few hours, typically on the hour. Depending on the programming, that may be more or less likely to be a commercial break.
Marketing research probably has strong indicators for when the most people get in their cars or turn on the radio at home. And they know that people tend to change the channel until they find music, and then are much less likely to change it during their commute. If your competition is on commercials, you can either also go to commercial, or you can try to steal those listeners with content.
I don’t know how common it is now, but I know stations used to have syndicated programming as well, so they would have a local DJ or prerecorded local identifyer between songs or other content, and then the content would come from a regional or national feed. I know PBS works this way, because there are places where you can tune into different public stations and hear the same content. But to do that, you would want standardized, predictable commercial timeslots. Modern network communications and automation could probably eliminate that need, though.
And of course there’s always coincidence. You remember the times when you happen to flip through stations and hear only commercials, but you quickly forget the times when you only have to change one station. You don’t even know how often every station you’re not listening to will go to commercials while you’re listening to music. So there is a significant confirmation bias.