When a spouse realizes that their marriage is over, they often don't want to put off their inevitable move from the family home. They instead want to get the process over with right away. Many husbands and wives leave their kids behind with the other parent when they do this. They do so based on the assumption that their ex will be amenable to them continuing to interact with their kids as they please. This scenario often doesn't work out this way though.
One of perhaps the worst things that you can do when you're preparing to file for divorce is to move out of the home that you share with your husband or wife and kids. In most cases, it sends the message to the judge who will ultimately preside over your case that you gave up on your children. It also tends to make them think that you have no concern for how your kids. It makes them think that you don't realize how your actions disrupted their lives. This can result in them denying your custody request.
The one instance in which a Riverside family law judge may be apt to award you custody is if you leave the home and take your kids with you. This may send a message to them that you're trying to do whatever is necessary to protect them. It's important that you contact the court right away if you do this though as it may otherwise look like you were trying to undermine the custodial rights of the other parent.
Custody matters are often complex. It's easy for such concerns to spiral out of control pretty quickly, especially if a parenting plan isn't in place between you and your ex. You should reach out to a child custody attorney early on when you split up. It's important that they're prepared to protect you and your children if you wish to have the best outcome in your California case.