which means the type T is not allowed to contain temporary references inside. This is necessary, because otherwise Any casts would create loopholes in borrow checking and safety.
You don't need to make reference to Any static. Just "content" of Any must be owned or otherwise non-temporary.
You can slightly modify "reference alive for the lifetime of the program" to "values that can stay alive for the lifetime of the program", and you get the correct interpretation.
Keyword "can". There's nothing stopping Foo from keeping the value of type T alive for the entire program, which is the key detail. The fact that your Foo is dropped at the end of main and thus not actually alive for that long is not important — you could have leaked the memory instead and it would still compile.