Applying an Action to all (or selected) Layers in a Document can be done via Scripting – it would not quite be what you described but might be helpful nonetheless.
Should you want to look into it and need advice check out
https://forums.adobe.com/community/ph...