I think probably
you should use a TABLE element instead and use the left column for line numbers and the right column for text.
There was, of course, the fashion to sneer at TABLEs as obsolete, and to use ONLY things like DIV, but that equivalent would probably be to put a scrollable DIV inside a fixed-sized DIV with scrollbar, subdivide the inner DIV into 2 more DIVs and then put the TEXTAREA div into the right-hand side sub-div. Which is really just a more complicated way to doing it in a TABLE anyway.
Incidentally, a common trick for editable table cells is to keep them as constant text with an onclick script that swaps in a relocatable text editing control for editing purposes, then writes its contents to the overlaid table cell when the edit is committed.