Fix compiler bug where compiling a list of files using an `hook/1` option would result in redundant cached clauses used for optimizing the calls to the term- and goal-expansion methods