Ever had a party get 'sniped' by an aimed shot of iron ball from a mile away able to hit a specific horse-sized target? Because that's what counter-battery fire is: Cannons shooting other cannons at that range.
Those fast moving zig-zagging cannons! Sure, if the party was stationary
Although with a group they likely use case shot, where a cheap tin can would be filled with 50-100 musket balls. Aim twenty yards in front of the party, the can bursts and create a fan of lead, each ball able to shoot through multiple people or a horse.
The party isn't moving straight. Are you really saying that they can accurately change the cannon's aim to accurately follow a very small, fast moving, zig-zagging party?
So the party responds with overwhelming force yeah? Wait, no, nothing has close to a mile range. Hope you have a caster with teleport still alive, because you now need to run four thousand+ feet to get in bow range. Lets say magic-boosted speed of 90, take double moves so thats 22 rounds.
No need. The shot was where the party used to be, because they aren't sitting still like a cannon.
Yeah but now the PCs with longbows can start to shoot back. That single cannon will go silent quickly. Except cannons are rarely singletons. They are units. Napoleon would take a 100-200 cannons on campaign and concentrate fire on specific targets.
Sure, but this is about the BBEG by himself shooting a cannon at the PCs. That was the suggestion. Not hundreds of cannons with thousands of people. There is one cannon and one guy. Maybe the guy has a group to help him, but it's still only one and still isn't going to be able to accurately track a fast moving, zig-zagging small party of adventurers.
How do they survive 18+ cannon blasts on that run to bow range?
By not being there when the shot hits, because the cannon shot where they used to be since can't track them that quickly.