This only applies when the unit is next to your unit and you do not actually move into the square you are attacking, so this is fine. Part of the reason I think this was implimented is because sometimes stacks of units can stand on top of each other.
Meaning you would end up consuming movement points because you had to attack those settlers and that caravan before you could attack the incoming army, all from the same soveriegn. I do not believe this is a bug ^^