Reordered Factory:createComposer function to init plugins before loading composer.json file

I was developing plugin with custom repository class and stuck in the corner with this because plugins are inited after composer.json is readed and custom type repository is not registered and composer crash with exception that type is not registered. I have played a little with this code to make it work. I have tested a little bit by myself and it works but I am not 100% sure it not damaged anything. Maybe someone with better understanding in composer core could make some changes or guide how to implement custom repository type