That’s my understanding, fleshed out somewhat. I’ve heard Hannibal died before capture and I’ve heard he poisoned himself to avoid capture. Either way, he was never captured alive.
I was refreshing my memory during my big droning post (I did add "small" HTML tags), and there were different versions even among ancient writers. The poison may not have been his idea, and may have come as something of a surprise. IMHO, his supposed last remarks were probably made up by some alleged poet.