The posted thing doesn't take gold/food/lumber into consideration, but it should be practialy almost no problem for one real player.
Because the player has maximum 0.1 seconds time to click on the icon to cancel, and then he gets back at first the hero required costs, so he to break it, he needs to switch buildings, or use hi gold somehow else magicaly and on purpose in this micro duration.
But we can make a safety check a bit later, probably, and maybe there's also an other potential risk. Would you know one more? We might maybe co-release it as a resource, it might be useful.
I mean damage/buff combinations between spells like say when a unit is stunned by Storm Bolt and then you quickly cast Thunder Clap on it something else happens as a bonus, be it more damage to that unit with both buffs, stun and Thunder Clap or getting more slow or temporary attack or armour reduction. Something like that.