Upon further investigation, there is a separate bug, where anvils over-eagerly triggers the profanity filter when the start of a word is blocked, even in single player (note that "night" causes the issue, "glass" does not). The way to get around this is to misspell the word then using arrow keys to fix it. This bug is being marked incorrectly as a duplicate to this.
How is this a duplicate?
The realms issue is about realms multiplayer, and has to do with signs, etc. getting blanked, and presumably has to do with a realms server-side filter or something.
This issue happens even in single player. It makes it difficult to type certain normal words that start with a bad word only in an anvil.
Regarding the issue with regular words:
The devs need to whitelist all words that are not swears.
And whatever censored the Cyrillic equivalent of sos (s is c in Cyrillic) needs to be fixed.
This issue happens in a lot of programs. It hard (possible though) to intercept the keys before reaching the IME.
Just use Win+space to switch to English.