It's the DM's fault that he or she created a challenge the difficulty of which can be reduced by players having foreknowledge of the creature's power. If you don't want to have that possibility, the best approach in my view is to change up the beholder or use another monster. Maybe the central eye is a reverse gravity spell.
Nothing? But I have no interest in pretending at it.
Ah, and now we come to it.
Pretending not to know, for an experienced player, is and always will be part of the game - and a fact of life - if there's to be any level of immersion in the thought process of your character(s) as they discover and learn about the game world and what's in it...and how best (or worst) to deal with it.
It's tangentially related to the lore/canon issue in those other threads: even though the player might know everything there is to know about the world of Greyhawk it's extremely unlikely (to the point of near-zero chance) a given character will have anything close to that same level of knowledge. For the character, it's a journey of discovery even though the player may have seen it all before...and the steeped-in-lore player then has no cause whatsoever to complain if that journey discovers some non-canon elements, as to the character that's just the way it is.
I-as-player know that trolls don't regenerate fire damage, but my character doesn't (yet) and until she learns it I'm goong to play it as if she doesn't know. What I know is - and AFAIC should be - irrelevant. Trial and error.
Your preferred option - which is valid, but tedious for the DM - is to change things up. Trolls become vulnerable to electricity or cold, for example, rather than fire. Red dragons breathe acid. Green dragons breathe toxic butterflies. And so on. However (and I've tried this, in the past, before abandoning the idea) what I've found is that doing this well ends up requiring a complete homebrewing of much of the Monster Manual...hence my comment about tedious; as that's a big book.
I assume nothing about character knowledge and leave it to the player to decide what the character believes. The character may or may not be correct in that belief
...but let's face it, in a game such as you propose their belief is going to be correct far, far more often than random chance would dictate.
Lan-'dragons breathing toxic butterflies...hmmm..."-efan