For classics maybe, but for TdF, a “crucial attack” isn't going to do much if you aren't able to ride faster than your opponents in average on the whole climb, and doing that is going to have an impact of the timings (each “col” has its own record table).
Drafting’s a factor on many climbs at the crazy speeds they achieve, and it can be enough of a benefit for a slightly slower rider to keep up with a slightly faster one. That’s why it’s rare that people ride away from others on a climb without an attack to break the draft.
A few hundred extra watts for a few seconds could be the difference between a failed attack and a stellar attack, then allowing the attacking rider to ride away.
(Of course, the weight of the batteries and motor would have to be considered as it would slightly impair the climbing performance.)
You're forgetting all the unsuccessful attacks where the attacker is simply swallowed back by a faster pace of the racers left behind by the attack.
I can see situation advantage for a very strong, title contending, competitor, but honestly that sounds too niche to be really useful.
Also:
> That’s why it’s rare that people ride away from others on a climb without an attack to break the draft.
Did you watch Tour de France the past few years? Even without attacking, Pogacar was simply too fast to follow in the mountains for everyone but Vingegaard, so there's only one guy who could have gained something and it's two times champion Vingegaard. Talk about a niche.
Pog's a special case. :)
I'm thinking more of a breakaway situation - a group of roughly equivalent riders, all knackered after a hard day in the breakaway, all vying for the stage win. If someone gets a gap, 90% of the time 'group two mentality' takes over and they don't organise a successful chase. Giving one of those riders an extra boost of watts for a few seconds for that attack could make all of the difference.
You're right that it won't always work, but these things are a numbers game - most of the time, breakaways are swallowed up, and even when a breakaway rider wins, (obvs) the rest of them don't win. And yet people still join the breakaway, to try to realise that tiny% chance of winning. Going from 5% to 10% win probability isn't much overall, but it's still doubling your chance.