Yes, I am sure that licensing figured into the decision as well.
KHTML and KJS are licensed under the LGPL. https://en.wikipedia.org/wiki/KHTML
Blink is also licensed under a mixture of the 3-clause BSD license and the LGPL. https://en.wikipedia.org/wiki/Blink_(web_engine)
At the time Apple (and later Google) made the decision to create their own browsers, I remember reading articles where they said one of the major reasons for going the KHTML/WebKit route was the modularity of the code as compared with Gecko (which allowed for better performance on wimpy devices like the cell phones of the day). However, I am not able to put my finger on any of the links to those articles right now. Some things really do get buried on the internet if enough time passes. (Note that Mozilla has made a lot of effort to improve the Gecko codebase, especially in light of the speed wars that Chrome launched, so it isn’t as bad as it was when Apple and Google made their original decisions).