@DetroitKp The 2nd config you posted (corresponding to the USB controller being plugged in) is a full RA config, that is produced when you save the config from the GUI (or enable saving on exit).
Are you sure it's the same file you're posting ? I don't think there's any mechanism in RetroPie to switch those files depending on the controllers used. Maybe the 1st file is the one from /opt/retropie/configs/all and the 2nd one from the /opt/retropie/configs/arcade ?
When you configure a controller, Emulationstation will create a controller configuration file in /opt/retropie/configs/all/retroarch-joypads with the button mappings, and that's all.
Your configuration steps are fine, and to choose what player the controller gets assigned, you indeed have to set input_playerX_joypad_index. So 1st controller would have the index 0, assigning it to P3 would be
input_player3_joypad_index = 0
etc.
You can leave input_autodetect_enable to true , otherwise the auto-config mapping for the controller would not be loaded.
I would check where the 2nd file is coming from and if it's from the /opt/retropie/configs/arcade folder, you should reset it to default:
# Settings made here will only override settings in the global retroarch.cfg if placed above the #include line
input_remapping_directory = "/opt/retropie/configs/arcade/"
#include "/opt/retropie/configs/all/retroarch.cfg"