How can someone create a right angle tool "from scratch"?
If you can create a straight edge, you can construct a square. You don't need to know any trigonometry beyond the idea that two right-angles make a straight line.
1. Produce a straight edge
Generally, to the level of accuracy needed for woodworking (joinery etc) you can tell whether an edge is straight by looking along it with your unaided eye. You can construct tools such as long wooden "jointer" planes that aid in the production of straight edges on planks but the general technique is not dependent on having a straight tool already. If your eyesight isn't good enough you lay your straight edge on another flattish plank and draw a line using the straight edge, then you rotate the straight edge 180, align its ends to the first line and draw a second line over the first. If the edge isn't straight the two lines will visibly diverge at one or more places in between the aligned ends.
This is a simpler case than creating a perfectly flat two dimensional surface of the sort that precision machinists use to check their work and their tools. A typical high-precision granite surface plate is flattened by nothing more complex than rubbing two lumps of granite together. Quickly measuring the flatness to high accuracy may require precision optics but this isn't really a task that requires powered machinery or electronics. It doesn't require a reference surface.
2. Use the straight edge to produce a square.
You can then create an L-shaped "square" by eye and check it against your straight edge. The method is to lay one arm of your square against the straight edge of a plank and mark a first perpendicular line across the plank along the other edge of the square, you then flip the square over, align the square where the line meets the straight-edge and draw a second perpendicular line across the plank, this will likely form a narrow V because your square is not exactly right. You can see how far out your square is and make appropriate adjustments, repeating the process until you are no longer able to see any divergence in your perpendiculars.
Current day carpenters and machinists routinely use these methods to check squares.