How do I stop a hacked robot from following me?

Solution 1:

From the Robotics Expert Wikia page,

To make a robot commanded with the Rank 3 perk stop following the Sole Survivor, just hack another robot.

It looks like you just need to hack another robot to have it stop following you, but this doesn't specify if it will go back to the vault. However, I did notice the following:

It is not recommended to hack Percy in Diamond City and use the command option. This will cause him to follow the player character as a companion, potentially getting him killed. There is no way to make him go back to Diamond City permanently.

I'm not sure if it would be the same for a robot you took from a vault or if this is a special case due to it being a named robot.