Where are you from?
> Anyway, based on what I constantly hear on HN, freelancing may be overrated.
You and I must be reading a different HN. Running your own agency or consulting business if you're not a sales-oriented person may not be the best thing, but subcontracting to an agency is hardly sales-oriented.
Freelancing with an orientation towards very low-end commodity-type of gigs is fantastically bad. Don't do it. Focus on connecting with an agency that does programming work with businesses with revenues that would make your desired wages be a rounding error.
> I find it difficult to compete against Indian or Bangladeshi programmers, even when I can clearly provide much higher quality.
Hmmmm... Based on this comment, you might be limited by geography. If you are in the US, there are trivial things you can do that make it so that you are not competing against Indian or Bangladeshi programmers.
That said, even if you are in some far-off place and need to work remotely, good programmers are not easy to come by. The "cost" of being remote and unknown is that people who are looking for good programmers are often not willing to spend the time separating the wheat from the chaff. The solution to this is to do some quality work, post in on GitHub, and then show your work to agencies.