1 x 2 Doug fir would have been sufficiently strong to attach the shelf hardware to. No need for 2 x 3 or even 2 x 2. It has plenty of screw holding power and plenty of strength too.
But I do have a method I use to make the screw holding power stronger when going into that 3/4" wood depth. Buy screws one length long than needed, start threading into the wood with those then back them out. Next trim the pointed end off the screw tips to get them to a length that is just right. If you do it this way then you have all the full gripping power of the widest diameter of the shaft instead of the weak gripping power that is at the tapered tip end of the screw.
I do that screw trimming method for all the wood pieces in my trailer remodel. I trim them to size using a fiber cut off disc in my Dremel motor.
Tall closet in a Sunrader that was framed with 1x2 Doug Fir attached to 1/8" plywood sides. It is very strong and sturdy. No need to over build, just choose the right lumber that has strength plus good screw holding ability and is still relatively
light in
weight compared to hard woods.