[backport] [stable6] Skip filescan but execute hooks

Backport of #8607