Something in code says to stop melee timer when you JA or cast (or maybe more simply, it's a default delay addition and the timer truly is counting down all the time). Implement check to maintain countdown (or eliminate that addition) if user possesses Combat Caster trait. Timer hits 0 while spell is being cast, attack is executed with whatever stats are determined, swing delay is reset as relative to current haste/weapon delay and the CC check is run again. Spell ends, timer is still ticking away, next attack round goes off and things are basically as normal until another spell is cast.

I know "spaghetti code" is right up there with the "PS2 limitations" lingo of why things could never happen in FFXI, but let's not pretend a couple conditional code checks are an impossibility.