I felt like a failure for a while recently, but it wasn’t until my son was 24
I get the feeling your toddler is acting out due to your separation. I’d not let him physically hurt you. I remember the preschool used to teach the kids to ‘use their words’. Three is old enough to understand that the physical acting out is unacceptable. You could do a time out, or take away a treat if he does it, or reward him for being good with a little treat often (but not make that too much of a routine so that he expects and demands it)