I didn't do any math, just going off of experience building quite a lot of encounters here. If an exact calculation is what you want, leave a comment and I'll delete this answer.
Coinflip encounter
This encounter will come down to the initiatives rolled. With 13 AC and 28 hit points, neither of the swarms should live more than one attacking round from the party at level 6, even taking into account resistances. They should however take up approximately that round of attack by the players.
Which leaves the Living Spellbook, which gets a practical one round of free attacks because the players will be dealing with the swarms. If they're careless or unlucky (aka, you felt like giving them a hard time), the book will use two multiattacks on the sourcerer or artificer, who should go down fast. At that point the combat depends on whether they were able to dispel the mage armor. If the swarms got off an attack before dying, I'd say those chances are low. Otherwise they are high and the fight should be a breeze for the barbarian and fighter (the arcane explosion should do approximately zero agains them with a Strength saving throw).
So the 2 scenarios I see happening are:
Swarms have relative high initiative
- The swarms attack the artificer and sourcerer for about 50% of their HP
- The swarms die
- The Living Spellbook effectively takes out the artificer and sourcerer out of the fight
- Mage armor isn't dispelled, your barbarian and fighter have a hard time, but should barely win out before any deadly casualties. Bad dice rolls for the player result in a loss
Swarms have relative low initiative
- Swarms die immediately
- Sourcerer dispels mage armor on the Living Spellbook
- Living spellbook becomes a glass cannon with 14 AC, which both the barbarian and fighter easily break
- Fight is a breeze, biggest risk is a small paper cut by one of the twirling paper sheets
It's definitely against the rules, but not unreasonable
The scenario as presented is fairly reasonable, but the ruling isn't RAW, and if this irritated you it's completely justified.
Plainly put, forced movement breaks grapples, and it doesn't care which creature is moved.
PHB pg. 290 under conditions, Grappled:
The condition also ends if an effect removes the
grappled creature from the reach of the grappler or
grappling effect, such as when a creature is hurled
away by the Thunderwave spell.
On top of that, Water Whip is a Dexterity save, not a Strength save. It also doesn't have an escape DC, which is telling. Like Thunderwave or Thorn Whip, when something gets moved by it, the magic is what's doing the moving and the only way to avoid that is to pass your Dex save and dodge it, or to use magic to counter it.
So in this scenario, your Water Whip should have torn the restrained party member from the grasp of whatever was dragging him. It doesn't matter that he's grappling the target. If the DM didn't want the thing to let go, the DM should have had it get dragged along with the restrained character. As a DM myself, when I do play a character and I'm escorting something I've restrained, I make it a point to tie myself to the creature I've restrained specifically to prevent scenarios like this from ever happening. I also keep a tether on my weapon for the same reason.
As for this:
His logic was that you couldn't make a Water Whip to a creature restrained, and chained, to a wall and expect it to work.
This is actually bad logic. This is called a false equivocation fallacy, where the scenarios are not discussing the same thing. Walls and chains are unyielding, inanimate objects anchoring the target because they're fixed.
Best Answer
Your spellcaster could have escaped.
Your spellcaster wasn't gagged, so he/she could have cast the second-level Misty Step, which is verbal only (and a bonus action to boot!). This allows the caster to teleport anywhere that's within sight and within 30 ft.