I won't make a blanket statement, but most of the bike/traffic laws I've researched all have the caveat about safety and useability. It's the loophole we can use to keep ourselves safer.
OP, the only thing I would have done different than you would have been to move back out into the car lane after the SUV went by. Otherwise, you were a textbook example of a courteous and lawful cyclist!