I think you would be better off looking for voice-recognition software, as there seems to be more interest in coding by voice.
That said, for writing on a touchscreen, do you remember Graffiti for Palm OS? You could use something like MyScript MathPad on iOS. It’s geared towards converting handwriting to LaTex, but it should have the symbols you need for programming. MyScript has a couple other options, like their Stack keyboard (for one character at a time) or Nebo for longer documents.
If you prefer writing on paper, you can probably improve accuracy if you use a structured form where you write each character in a box. This is called handprint. By printing out pages of boxes first, and writing one character in each box, you make it easier for the software to recognize and correctly identify individual characters, and improve whitespace management and identification. It sounds like you can train and fine-tune Tesseract to your personal needs, given enough time. This post from StackOverflow says you will cap out at about 90% accuracy, but I think that is for handwriting, not handprint. Here’s a question about using handprint with Tesseract. If you don’t have the time to train Tesseract, but you have the budget, there are plenty of commercial options for reading handprint forms, but I haven’t looked into these.
Writing on a touchscreen or graphics tablet will tend to be more accurate than ICR of static images of characters, as the software will be able to use the way you wrote the characters to provide more clues as to the characters’ identity.