** scripture.......often has nothing to do with the homily.**
Hmmm Strange. The priest is directed to preach on the Holy Scripture. What you may have witnessed would not be according to what is supposed to be done.
As I said, I have been to scores of masses with scores of priests. Most of the time, their homily may be loosely based on the scripture, but it often, if not almost always, is not necessarily scriptural but rather their own opinion without any exegesis at all. Often it is an odd stretch to somehow fit that passage into what they wanted to talk about anyway, or about one of their favorite "causes". It is not much different than going into many of the apostate mainline protestant denominations and hearing a social sermon loosely based on a verse or two. (Of course there are always decent pastors in those also, but generally few and far between).
That doesn't mean I haven't heard a decent homily or two, but generally it isn't the case.