As far as I know, WotC rarely contradicts itself lorewise in an edition? Like things change in between editions, the lore is different between 4e and 5e for example (like 4e allows gnolls to be civilized while 5e basically made em always fiendish feral), but during an edition things don't contradict often (or atleast I can't think of any moments). Things can massively change, and sometimes new things are revealed, but WotC doesn't mess up their lore in a set.

Also people talking about how a level 18 mage is a CR12 enemy is why I said they don't follow player rules too closely. CR isn't completely tied to level and things can be a little loose. I will admit the MM is not the thing I am most knowledgeable about, I mostly pay attention to what I can summon. However, something I noticed is Cr doesn't match levels and often times Monsters have something that is different for them that makes them special in a fight against a player, sometimes it is innate spellcasting or recharged abilities or something strange, so to me a singular enemy having more spell slots than normal is ok if not every enemy has that. It becomes a problem when every enemy deviates from the base of players in the same way because it then becomes predictable and arguably unfair/unfun.