Unfortunately, or fortunately, depending on your point of view, the answer is never that easy.
I should start by asking for clarification on when you want to switch in/outputs. You mention when 'the Mac switches to a specific user'... does that mean at login? or does that include multi-user switching where you may have multiple accounts logged in at once.
The latter is tricky, but the former might be achieved via a login script.
I couldn't find a simple, direct way to switch inputs (which did surprise me a bit), but you can always revert to UI Scripting (hence the 'unfortunate' part of my opening sentence :) )
This script will emulate user actions to choose a specific output device for audio, provided the Sound menu extra is enabled in System Preferences:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "System Events" to tell process "SystemUIServer"
tell (menu bar item 6 of menu bar 1) --> check your menu bar item ID
click
click menu item "Internal Speakers" of menu 1 --> set the name of the output device to use
end tell
end tell
Like most UI scripts, it's crude and hacky - you may need to change the menu bar item ID to match your setup, but I couldn't find a consistent name to reference it by.
Once you get it working you should be able to save it as a login item so it runs when you log in.
Hacky, but the best I could come up with in a pinch. :)