We have a Lore FAQ page. If you have Story/Lore related questions - make sure to check it out!
At which point in the game 9S learned the truth about 2E?
The official designation...is 2E. Number 2, Type E.—A2, Chapter 17-09 9S
A2's rhetorical question during the finale of Route C as well as 9S’ reaction to it clearly indicates that 9S had already long known by that point who and what 2B really was. However, the exact moment he figures out her true nature is ambiguous.
9S is an extremely clever android, and if this iteration was anything like his past selves, it is most likely that 9S realizes at some point during Route A/B that 2B is there to monitor him. This tenacity to learn about 2B's intended purpose is shown several times in A Repeating Prayer.
2B: 9S ... knew that I was ... an Executioner model?—A Repeating Prayer 
It is most likely that 9S figures out that 2B is there to monitor him during Route A/B, it isn’t until the Amnesia sidequest that he learns E types even exist. It is some time after this point, he puts two and two together, realizing 2B is in fact an executioner model herself, 2E.
After fighting beside with 2B for such a long time, he realized that she was “too strong to be a mere B model”. That was the only card that fit. There was no mistaking it.—A Long Story, Chapter 10