Symbols are created at the instant that they are read -- not when they are evaluated.
In the first example, there are two expressions:
myProgramF[...]. The first expression is read and evaluated, loading the package. The second expression is then read, resolving
myProgramF using the loaded package. It is then evaluated.
In the second example, there is only one expression
Block[...]. First it is read. Since the package has not been loaded yet,
myProgramF will be resolved in the
Global` context. The expression is only evaluated after it has been fully read. The evaluation causes the package to load, triggering the shadowing warning.
The third (
Block[...]) and fourth (
Module[...]) examples behave in the same way as the second: the expressions are read completely before the package is loaded.
The first example also contains a subtlety in its own right. One might think that it is a single expression consisting of a
CompoundExpression[Needs["myProgram`", packageFile], myProgramF]
But it is not. Rather, it is two expressions like this:
CompoundExpression[Needs["myProgram`", packageFile], Null]
The Mathematica reader always takes a conservative approach when reading. Once it reaches the end of a line, it will stop reading if the expression read so far is a complete expression. That is why we get two expressions in the first example, but each of the other examples have only one expression.
If the first example had been written like this:
... then it would be read as a single expression and would cause the shadowing warning that we see in the other examples.
Incidentally, it is because of this conservative reading strategy that we cannot write expressions like this:
, argument2 + anotherBigLongExpression
... not that any sane person would want to write code like that, of course ;D