I've never noticed a ship (authority, Bounty H, pirate) charging towards me when scanning. When they are scanning me, they are flying in a parallel course to me, with their nose pointed towards my ship. Watch your scanner at this time (and don't change direction) - when you get scanned, you'll see another ship's marker remain in the exact same spot in the scanner while the markers of other ships move about normally. When the NPC finishes scanning (and I get a message from them such as "You're clean, commander"), that's when scan 'n ram seems to occur. If you're going "too fast" (for whatever speed "too fast" means in whatever context) when they finish their scan, they charge at you. If you're not going "too fast", they fly off in some other direction.
I can't comment about NPC behaviour in RES sites - I haven't personally seen this issue there, because I haven't been in a RES site in a while.