There is already a hidden feature to switch users quickly by URL that you could leverage.
In development mode, visit session/USERNAME/become with a GET request and you will impersonate that user. So you could adjust your plugin to just link to that GET route instead.