I only wish I could favorite this more than once.
Consistently communicating and enforcing these boundaries has been a huge benefit for my career. I've implemented a version of this in Teams' "status message" that is displayed whenever someone is typing a chat message directed my way. It really helps.
Not only does it help me, it helps change the overall work culture. I know tens of people who have adopted similar boundaries (many copying my status message verbatim, with my blessing) and have had many others thank me for helping them understand how best to work with me.
Anyone, manager or other, who argues against this type of behavior is explicitly telling you that your time is not valuable, and by extension that YOU are not as valuable as the random interruptions that others choose to send your way.
Being clear is not rude - it's documentation.