Under Russian laws, when a married couple with minor children is filing divorce only the court has the right to decide with whom the children would stay and to establish parental responsibilities of the other parent such as alimony and visitation rights.
The court would consider the best interest of the child, no genetic relationship with the child (should an egg or sperm donation program be implemented) would be a guarantee that a genetic parent would be granted a custody.
Outside of the courtroom parents might write an agreement addressing the rights and responsibilities of custodial and non-custodial parent. Such an agreement should be approved by the court and might be amended only through another court decision.