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

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