I could agree with this if, and only if, there was an in character reason for this sudden change in behaviour.
That's thought policing, but here are some reasons for this "sudden change of behavior"
1) You character has always trusted what this other character says about threat assessment, but this time it just seems too much to believe. Like most normal folks without supernatural powers probably trust their friends to tell them the truth, especially about things that matter, right up until they say something that seems completely ridiculous like "I think that guy in the security uniform at the door over there is Bill Nighy."
2) The game has only covered a small sliver of your character's life, and is thus too small of a sample size with which to judge this moment, rather than everything in-game up to this point, as being the "out of place" behavior.
3) Sometimes, people do things they don't normally do.
In the same way, if a sorcerer starts every fight with Chomatic Orb (cold) and has done for the past five levels, then I am going to question the use of Chromatic Orb (fire) when facing trolls if no previous knowledge has been established to support this action.
More thought policing. That I eat a bowl of honey bunches of oats for breakfast every day for three months doesn't make it strange that one morning I decide to have bacon & eggs, and this sorcerer changing their mind about what spell to cast first in battle is the same (from an in-character point of view).
Sure a character could know about trolls, but since a character does not exist beyond what has been shared in game and approved in their backstory by the DM, the character is assumed not to know unless established before the situation arises. In cases where this has not occurred then it is fair to ask the DM if you would know and, with approval, roll the appropriate knowledge check.
Do I also have to ask the DM's permission to have knowledge of my character's family members that have yet to come up in play before the moment some NPC wanders up, calls him nephew, and tries to hug him, or to invoke a tale of my character being taught to make pie by his loving grandmother? Why be inconsistent about when I as a player get to decide what my character
does know from the list of things my character
could know?
Personally, I believe that in the troll situation the DM should describe what the characters see rather than naming exactly what they are facing. If the challenge is in the identification of a creature rather than its abilities then there is significantly less chance of metagaming (which does exist).
You must have missed out on the conversation in which the troll scenario was brought up, which isn't surprising since it was on another forum entirely - the DM didn't name the troll, just described it, and the player didn't care whether the character knew they fighting a troll or an ogre, they just wanted to use fire because it sounded cool and was readily available in the form of the camp fire the character was sitting near when the monster attacked.
And the DM (Maxperson in the debate) said that it was meta-gaming to use fire instead of the sword that was also nearby, citing that the player (me in the debate) knew it was a troll from the description given.
Which is where that whole test I mentioned earlier of whether a complete newbie player with no knowledge to "abuse" could make the same choice of action in the same scenario, and if yes it can't be meta-gaming because the action doesn't require any specific knowledge.
One of my favourite ways to identify metagamers is to change a crucial detail about what I believe is being metagamed. Since nothing is set in stone until established by the DM, I enjoy changing trolls' vulnerability to lightning instead of fire and giving them resistance to fire. Players who assume that fire will save them without bothering to ask if they would know the vulnerability (that is, players who metagame) often tend to get upset when they blow their biggest resource for little effect.
Springing a "gotcha" on your players does sound like something it is reasonable for them to be upset about, especially when it is something like changing up what you have allowed to become basic assumptions for the reason that your players are assuming the basic assumptions of the setting haven't changed.
When they start their objection with "but the book says" they are clearly identifying the books as the cause for their actions rather than the character.
Yeah, better teach those nasty players that nothing you or the book says can be trusted because you will change previously established details on a whim just to give them grief if they dare get comfortable enough with your established setting to think they know what is going on without your express permission to think that.
Without fail, that player will then start asking about how things work in the game. If they have a decent justification I will frequently just give them the information. For myself and my table it has worked out very well.
Of course a player you have given a proverbial spanking will start trying to figure out what you want them to be doing, getting spanking and having no idea what for tends to make people very curious.
You could entirely skip the "gotcha" process and reach the same end result of having players that know what you expect of them by simply explaining it to them before hand... though I expect if you do like Maxperson and insist that they can't ever have their character guess about something unless the player is also guessing, you are going to end up either with a lot of characters that devote their resources to knowledge, or a group of players that intentionally let their characters fumble through basically everything because they'd rather devote their resources to things other than jumping through the hoops you insist on having anyone that wants to make informed decisions jump through.