The main problem with high-level D&D in most CRPG adaptations is that D&D usually hands the player a lot of tools with levels, some of which are pretty interesting and aren't just variations of previously available effects. If players understand the system, and they get their hands on enough of them, they can combine these in ways that are difficult to foresee and which are either uncounterable or require specific solutions to be countered. Since most single-player game devs don't go down the PoE-style infinite balance patching route, this means that the devs write in counters for what they can think of during the balancing and QA phase (i.e. the most rushed period of most games' development cycle, because it has to be at the end), and the tricks that they miss stay missed. So the moment you figure out what Improved Haste + Mislead do to a mage/thief type in BG2, you have a god mode available. (There are about a dozen similarly overpowered combos in BG2, and dozens more which are unfairly strong but not game-breaking.)
Alternatively, you can just combine a large number of powerful effects in ways that make you very difficult for a scripting-based AI to defeat, not by breaking the game per se, but by playing by its rules more optimally than expected. Examples of this in BG2 can be found in most of the tricks employed by Tactics/SCS mages: sequencers loaded with resistance-lowering spells followed by contingencies loaded with heavy nukes, composing your party solely of characters who can cast layers of physical immunity self-buffs guarded by layers of anti-magic buffs, and so on. If you just rule that pre-buffing doesn't exist in your variant of D&D, that's a partial solution, albeit a kind of shitty one.
These tricks are more fair when used by the AI against the player than visa versa, since the player can bring in counters in itemization and encounter-planning that aren't available to the AI ("I'll wait until I get Carsomyr to fight the stoneskin-spamming wizards encounter"). It's just really hard to script against a player who understands the rule system well; you can see the evidence in hardcore tactical modders' attempts to do so. Take the Unholy Eclipse encounter. Here you have six max-level enemy antagonists with overpowered gear--and they all get a collective, free Time Stop that triggers every other round--and they're in a tiny room that doesn't offer the player any possible terrain advantages to exploit or room to set up traps. Their AI is miles ahead of anything in the base game. It's pretty straightforward for a soloist to beat them. If you've seen the Improved Asylum mod, it's probably even more unfair and in Chapter 4 of SoA (infinite spells, untargetable enemies with permanent invisibility and loads of spell immunities, characters who instagib you, auto-lose conditions if you don't defeat the enemies in the exact order the modder wants you to, power-ups that let enemies instagib you, instant time stop casts . . . ) and can also be beaten easily by a solo character who knows what's up, using only SoA-accessible loot and abilities.
The rules and interactions between different effects in BG2 are complex enough that it's very, very hard to cover all your bases in it, or to create an encounter that will challenge people who know the system well.
In comparison, a shitty system like you'd see in an early CRPG like The Bard's Tale II is really easy to write AI for: on your turn, you can choose between the effect that does shitty single-target damage, the effect that does large damage to a group, or the effect that does truly massive damage to all enemies and raises all your dead allies and heals them and gives them powerful armor buffs and also gives them extra attacks. (Which is better, and why?) This means that it's not hard to script enemies to be about as smart as a player.