Even if the intention of shoving him into the portal seems evil I'm still on Wagstaff's side. I mean, WX tried to harm Wagstaff by throwing the part at him which even breaks the rules being AI and Robots in the real world. So destroying everything relating to WX is the sensible solution. Also, he cared about his partner at first, seeming concerned when he looked at his hands after transferring consciousness into the robot body.