I’m an outlier for sure but $20k is low. If you do a great job at everything that goes into running a business like this you can definitely do much better than that. Josh Comeau did an incredible job building his audience and reputation before releasing his CSS course a few months ago for example and he has done over $500k if I remember right.
Writing is half the battle—it is a significant hurdle and not everyone can write a great technical book.
But the other half (and I struggle with this mightily) is sales/marketing (and the whole 'business' side). Making it look pretty, getting people to know it exists, promoting it.
Many of the best technical writers I know are not great at the latter, and for them, self-publishing might not be the best approach.