That's the "smartscreen" function, and it also depends on where the file is marked as having come from (and yes, it largely seems to be a racket to get you to buy cide signing). If defender actively thinks there is a virus through a signature match or heuristics then the behaviour is different, and more difficult to bypas (and yes, this can also have false positives, irritatingly).