I want to change the order of fields in login/registration form
You probably should hide this fields, and show them with javascript before captcha input value is not empty. Check it with "on change" function: 

 $('body').on('change', '#CAPTCHA INPUT', function(){}