The Plug
plug couldnt trust you now u cant trust the plug
It's a difficult comparison because a lot of the writers for these types of screenplays are writing from experience. City of God for example was penned by Paulo Lins, he grew up in the Cidade de Deus slum during the exact period he's writing about and shared a lot in common with his Rocket character. John Singleton on the other hand was raised in an affluent household in LA a world away from his Trey character.
One thing that's significantly different about film is that the actors are able to tweak the dialogue until it's natural for themselves. The way a script reads on paper is often very different from the way the dialogue is actually represented in the film. Same with tics, mannerisms, etc. They tend to be specific to the actor so ultimately if the casting is good they can float above the material even when its poorly written. A character actor will often talk to dozens of people who they think will relate to the character they're playing before they start putting their performance together.
With your two specific examples, Mario Puzo obviously got a lot of shyt for not actually coming from the Mafia background despite being an Italian who grew up in Hells Kitchen when it was poor and had the mafia element. His sensationalized romantic version of the mafia had a very lasting impact on the way that Italian organized crime is perceived worldwide and depending on how you look at it not for the better. That being said, a lot of the actors involved in the film did come from the mafia background and again they likely tweaked certain scenes in Coppola's film adaptation to be more natural. Films are much more collaborative efforts than rap albums... A rap album is specifically the POV of the rapper so it is a little different.
A rap album is also a collaborative process, music isn't created in a void.
Now with what you've written, do you not think a Kendrick talked to other people before or while writing his music? They would obviously influence all the stories he's written especially the ones in 3rd person.