There are two different objects in effect here.
On one hand the mechanism and on the other the virtual controller.
Your code is RobotStudio SDK code and looks only at the mechanism, ie the representation of the physical part. So changing the values there does not update the limitations for the controller. Rather it would be the same as having physical restrains on the manipulator arm.
So instead what you need to do is use the PC SDK - ABB.Robotics.Controllers.ConfigurationDomain. to change the configuration domain of the controller system. ie what is in the MOC file etc.
But before that you need to use the PC SDK to scan, connect and logon to the controller system.
To do that you need to go through the basics of PC SDK programming.
That is what they are doing inside RobotStudio when you change the contoller parameters, both online versus real controllers and offline versus virtual controllers.