When Should RIker have left? When He wanted to, in the crew of the Enterprise he found a family, which despite him saying so many times that he wanted the Captaincy more than anything else, he wanted to have what he was denied when he was young by his mothers death and his fathers abandonment. He developed a family and a purpose, his desire to be Captain was less important to him than that. Once he was ready to go, he accepted a promotion to the Titan.
When would it have happened in a more realistic universe? After he successfully defeated the Borg, he would have been posted to a new ship or possibly Picard wouldn't have gotten command of the Enterprise back due to his ordeal. If not then, both Riker and Data would've been given their own commands during the Dominon War, given the losses they would've needed highly experienced officers in command of their armada. Troi and Geordi possibly as well.
When would it have happened in a more realistic universe? After he successfully defeated the Borg, he would have been posted to a new ship or possibly Picard wouldn't have gotten command of the Enterprise back due to his ordeal. If not then, both Riker and Data would've been given their own commands during the Dominon War, given the losses they would've needed highly experienced officers in command of their armada. Troi and Geordi possibly as well.