I have this outlet with two wires under a single screw on both sides, which I've learned can be resolved through pigtailing. However on the hot side, one of the doubled-up wires is black and the other is yellow. Is it safe to pigtail these two together? I'm not sure what they're for to be honest, nothing is connected to this outlet normally so I'm not sure if it was for something it was previously used for or not. It's a 120 V 20 A outlet.
2 wires under a screw like that is not code compliant. A yellow wire is just like a red, pink, black or blue they can all be hot wires so yes it would be best to pigtail them. If the tab is intact between the 2 screws on that side I would pigtail all 3 together.
If the tab was broken and that was a multi wire branch circuit code would require the neutrals to be pigtailed. So it’s a good idea to do the whites while you’re fixing things.
It really doesn’t matter where the wires go. They could be powering the room lights or another receptacle and until disconnected you may not know
You can't put 2 wires under a screw like that, but I gather you knew that.
Yellow is a perfectly legal "hot" color.
You can pigtail them if you like. However, you could also buy a "spec grade" receptacle (the $3 type instead of the 60 cent type). These accept 2 wires under each screw (via a different method) and your 6 wires will fit on there fine.
Electrically there's no problem here. From an amateur "common sense" perspective, green/bare is always ground, white is always neutral, and all other colors are hot. The other colors do serve valuable purposes (when used correctly!), but there isn't a crisis here. They all could have been wired up this way for a lot of reasons, but at the top of my list is that a previous homeowner did it and they didn't want to spend more money for wire (choosing to use what they had).