Ah - the files are in an invisible folder.
I do not know whether this is directed at me or @Fotokunst.
In my case of looking at ~/Library/Messages/Attachments/ in flat view it shows files like:
~/Library/Messages/Attachments/xx/yy/zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz/123456.jpg
So "invisible folder" is incorrect in two ways:
1) Yes ~/Library/ by default is invisible. But because I access it quite frequently via Finder I set my Library folder to be visible via `SetFile -a v ~/Library/` a long time ago. Maybe you do not
check the filesystem flags for ~/Library/ but just
hardcoded assume it to be invisible?
2) Even if ~/Library/ was set to be invisible, then the statement "the files are in an invisible folder" would still be wrong. Only one folder along the filepath would be be invisible, "Library" in my example.
But in my concrete case all parent folders of 123456.jpg up until root ARE visible.
I went there in Finder and navigated up, up, up. And all were visible.
And I have set my Finder to only show visible files and folders.
So something in your intended meaning or your technical interpretation of "Hidden files and folders" seems to be wrong here.
3) I tested the new function "Change Notifications for hidden Files and Folder" in GC 11.6.1 (5483)
As pointed out in 1+2, none of my files or folder in that flat view are hidden. So semantically it is definitely wrong.
But success: I get the intended outcome! Files get immediately removed from flat view after deleting them when this option is ON. But not when OFF.
Screenshot Story:

- Deleting in flat view 1 start.png (429.79 KiB) Viewed 683 times

- Deleting in flat view 2 after one by one deletions.png (314.13 KiB) Viewed 683 times