Yes, that is the correct logic that I needed. user.roles will be null after first sign up. I had another rule that was assigning a default role to the user. Once I got that rule working (with the similar logic in your answer) things are working on sign up and regular log in.
// code snippet - logic in rule to assign default “User” Role after sign up
var roles = user.roles || ];
roles.push(defaultRole.name);
user.roles = roles;