As with Wesley on Buffy, she was written to die at the end of her arc (Wesley was to have been killed by Faith). They rewrote the trilogy and kept her around, then spun her off. I'd argue that even now, Xena is more popular than Hercules. As for Worf, yes. He was originally going to be in just the pilot, but the producers liked the character and kept him around. It was only when Denise Crosby decided to leave the series that the writers began to write for Worf.