I have done something similar to what you have here, but I tied the follow to my TAB key instead and made a mode-switcher key so that I can switch between standard targeting and "melee targeting".
\binds\meleetargeting\reset.txt
tab "target_enemy_next"
ctrl+m "tell $name, Melee Mode On$$bindloadfile d:\games\coh\binds\melee\melee.txt"
\binds\meleetargeting\melee.txt
tab "target_custom_near alive enemy notbase$$follow"
ctrl+m "tell $name, Melee Mode Off$$bindloadfile d:\games\coh\binds\melee\reset.txt"
I think the end result of what I've done is similar to your solution, but I find it better suited to my "right in the middle of the mess" play style.