[FrameworkBundle] Place initialization of $bundlesDir out of the foreach loop.

Code enhancement. $bundlesDir variable doesn't need any bundle information for initialization. So it must be placed out of the loop to not process unnecessary operations.