7.01 Right to an Unoccupied Base
A runner acquires the right to an unoccupied base when that runner touches it before being retired. The runner is then entitled to it until retired or forced to vacate it for another runner legally entitled to that base. If a runner legally acquires title to a base, and the pitcher assumes his/ her position on the pitcher’s plate, the runner may not return to a previously occupied base.
You may have to read it in conjunction with other rules. I searched my app and didn't see any example of your exact scenario.