Moved middlewares initialization

I found out, that middlewares are being put into instance.extensions only if they are placed here. It did not work in the place it used to be in 7.0.15alpha. I really don't know why, but I can see that in my instance.