Thanks for sharing the experience. I went through the H1B visa process a number of years ago. Although it's pretty tough being treated like you did, I think you and possibly the offering company went into the arrangement without enough information. I remember that the H1B pool is relatively small (in the 10's of thousands) per year. And that well connected immigration lawyers and sponsoring companies usually exhaust that pool within the first day they are released. After that, it's virtually impossible to get a H1B. And when you if you're lucky enough to be able to wrangle a H1B, it's a pretty convoluted and costly (for the sponsoring company) application process.
Good luck with the next round of H1Bs, the sponsoring company (and lawyers) need to get in quickly! You sound like a well qualified dev, and it's a shame that the US misses out on good talent because of an inadequate immigration system...