I started to wonder about this after reading 2 articles. One was about James Cameron originally not wanting MY HEART WILL GO ON in TITANIC. The other one was about how a lot of musicals adapted from the stage have a new track just so they can get a Best Song Oscar nomination.
There are many elements that are necessary in a movie. That includes the music score. Whenever a movie doesn't have it, it's because the director is trying to convey something. But what about theme songs? If the director wants a song to be played during the opening and/or end credits as a way to represent the movie... of if they want to place a song during a certain scene... the director can use an already existing song. Yes, there are rights to get, but assuming that's not an issue, the director has to ask themselves "Do I choose a song that already exists or do I hire composers to write a new one?"