Pretty much that, yeah! There was a Proto-Indo-European root *h₃reǵ- meaning something like “straighten out”, which has a lot of descendants:
- English “right”, in all its meanings (“correct”, “opposite of left”, “straight up and down”, “90 degrees”, “freedom guaranteed by law”)
- The Latin root reg-, with many forms:
- regō “rule (be in charge of)”
- rex “ruler (king)”
- rēgula “ruler (tool)”
- rectus “straightened out” > “straight, proper, correct”
- Descendants of regō/rex, like anything with “reg” in English (region, regal, reign)
- Descendants of rectus, like anything with “rect” in English (correction, director, rectangle, rectum (straight part of the digestive tract), recto (upright side of a document)), or -rech- in Spanish (derecho/a), or -rett- in Italian, etc
- Greek orégō “stretch out in a straight line”, which wasn’t a very prominent word but gave the technical term órexis “appetite, desire” (originally “yearning, reaching out for something”)
So the original meaning seems to be “straighten, set straight”, first literally, then metaphorically. A ruler (tool) is what you use to make straight lines, a ruler (person) straightens out their subjects, you can right a capsized boat (make it upright) or right a wrong, and so on. Once something has been righted, it’s now right (correct), and this state of affairs is righteous, and a right (like the right to food) is the righteous thing that laws should be protecting instead of violating.
(Several of these meanings seem to have started in Romance, then English-speakers started using “right” as a conventional translation of French droit (< Latin directus), so the English word took on all the extra meanings of the French word. But there was a lot of back-and-forth exchange, so it’s not entirely clear where things started versus where they went later.)
As part of that, 90% of the population is a lot better at using one hand than the other, so that’s clearly the right hand, and the other one is left. (The original meaning of “left (hand)” is “useless”, no relation to the things left behind once you leave them.) Anyone who does the opposite is clearly evil, since they do the opposite of what is right.
This correct~rightward connection is found in Finnish, Korean, and various Semitic languages, but interestingly not in Latin—the Latin words for “right” and “left” were dexter (hence “dexterity”, how good you are with your right hand, and “ambidextrous”, when both hands are right) and sinister (hence, well, “sinister”, when you’re left-handed so you must be in league with Satan). So it seems to have independently developed many different times.