You mentioned my favorite author. In one of his books he noted that he didn't make a dime on Foundation for ten years; his publisher couldn't afford to market it properly. When Doubleday bought the rights from the previous publisher (I don't remember who it was) it was a hit.
My advice is, write as a hobby. Yes, it will take longer; Nobots took me five years to write. Now that I'm retired I'm doing it full-time, I started writing Mars, Ho! this time last year and am just putting the finishing touches on it.
I took a page from Cory Doctorow's playbook and put e-book versions of the first two on the internet. It didn't work; I've yet to make a profit. As you've found out, Bowker (if you're in the US) is damned expensive. I bought a block of ten ISBNs, so they were $25 each. Registering a copyright is $35, and although your work is automatically "protected" it really isn't; if someone infringes your copyright, you can't sue unless you've registered it (of course this will vary by country).
This time I'm trying to follow Andy Wier's lead, at least partly. According to wikipedia, The Martian was rejected by all the publishers, so he put it on Amazon as a 99 cent e-book, where it shot to #1 and stayed there, and a publisher bought the rights "for a six figure" payday. I'm skipping the "submit to publishers" part. Hell, Harry Potter was rejected by over a dozen publishers. The e-book for Mars, Ho! will be a $2 e-book, and I'm not assigning any of my ISBNs to the hardcover or paperback. Those will be available only to fans.
Like you, I got into programming for the fun of it and enjoyed it immensely. When it became a job, it stopped being enjoyable.
Writing hasn't been financially rewarding for me, but it has been one of the most emotionally rewarding things I've ever done. I couldn't imagine what it would feel like to see someone chuckling while reading a humorous passage, or overhear someone raving about one of my books, or getting fan mail.
Writing is like playing music. I know an awful lot of incredibly talented musicians, none are making much money at it; musical instruments and equipment are expensive and bar owners are cheap.
Thousands of books are published daily, and some not great writing makes best seller lists. I don't agree with Stephen King that James Patterson is "a terrible writer" but the book of his I read didn't impress me a bit. But he makes money hand over fist, selling a LOT more books than King, who is incredibly talented.
But don't take something you love and turn it into drudgery. You'll stop loving it, just like programming.
(Huh? how come ¢ doesn't work here?)