First of all, welcome to PC. ^_^
As for the topic's question, I feel that Brock did do the right thing. I mean, to be a breeder was his dream, and he was more passionate to that field of Pokemon care than being a Gym Leader. His heart just wasn't in battling Pokemon. He stopped the battle between Pikachu and Onix because the Pokemon were in pain. He cares for the Pokemon and doesn't want to see them hurt.
So yeah, he did the right thing by turning the Gym back over to his father. It allowed him to go after the dream that would make him happy, instead of remaining at the Gym where his heart just wasn't in it.