Is this consistently happening, as you note, in "the first 10 minutes" after she comes home from preschool?
First, she very possibly is hungry and has low blood sugar making her very cranky; offer her a snack immediately in the car when you pick her up. She may say "I'm not hungry" but offer anyway, every single time. Offer something high-protein like a cheese stick along with a few crackers. Don't wait until you get home to give her a snack. Does her preschool's schedule have her snacking or lunching there, and if so, what time exactly is she last eating before pickup? Is there a long time (for her, not by adult standards) between her last food at preschool and her pickup time? Do you send her preschool food/snack yourself or does the preschool provide it? Is the snack sugary (cookies, gummies, sugary punches and juices)? If so, the sugary snack is burning off way too fast, leaving her even hungrier and crankier -- simple sugars burn up in the body much, much faster than slow-burning proteins. Change her snack at preschool and give her a snack in the car and see if that helps.
Second, she may be tired and at the same time very wound up immediately after preschool, both weary and over-excited. Again, what is the exact routine of the preschool day? Examine it, observe it if you can, and see what she's doing most days in the hour or so before departure. She may need more sleep at night, or a shorter preschool day, or some other adjustment.
The one incident at the dog park is unfortunate but if it's not typical, it's possible she was melting down because of hunger or tiredness. She was angry and embarrassed and so were you. Did you ask her later -- when she was calm and you were too -- whether something in the bathroom frightened her? If the toilet seemed dirty to her? Some kids are very picky about clean toilets. Did you ask if someone else was in there (NOT talking about molestation here at all -- just about how some kids become too embarrassed to "go" if there is anyone else around who is a stranger who might even hear them pee). She may have had a reason why she was frightened, even a little bit, to use the bathroom. Letting her go alone is your choice, and I am NOT slamming it; but you need to explore gently with her whether she dislikes going alone; she may actually still want you to go into bathrooms with her. It's not "backsliding" or making her babyish if she wants that at four. It's nice if you feel she's independent enough to do it, and she may say "I'm grown up and don't need you," but kids often will say that when they really do want their parents closer.
The swats, well, I am against any swatting or spanking, even taps. That's your choice too, but ask yourself how swats teach her anything, any changes to her behavior, in this situation. They punish but don't teach.