I am using chflags hidden method to hide apps in /Applications folder.
It immediately hides the application in Finder, but when I click on the Applications folder in Dock (image below), I can still see the hidden applications there, until I restart the computer.
So the question is: Is it possible to also update the visibility of the application in the Dock preview to Applications folder without restaring the computer?

Dock -> Applications -> Open in Finder, then even without restarting the app folder is hidden. However, it's not hidden right inDock->Applications, until I restart.spctl --statusand OS version - please correct @pablo. I'll delete our other comments since we're beyond them now. I'm curious as to the real nut to be cracked here now that SIP is implicated.