^Yeah it was heavily insinuated that Misty was pretty new to Pokemon training herself with her sisters talking about her leaving home to become a Pokemon trainer. The rules of gym leaderdom in the anime are pretty vague but I get the impression Misty was only a gym leader by virtue of being one of the Sensational Sisters.
Perhaps due to family relationships ties, this is one of ways for someone to become gym leader on that sole account.
I think Misty was gym leader, but not very experienced one. Afterall she did stated several times that she was gym leader before traveling with Ash(in main anime but in third movie as well), who apparently got fed up living in shadow of older sisters who belittled her and degraded her worth.
I think Misty had more experience and strength than typical rookie at that time(after all Starmie and Goldeen alongside Staryu kinda supports this thesis), but due to not having much chance to practice her skills in gym at that time due to older siblings shutting her of from most activities and due to being fairly new herself to journey her battling competence wasn't all that high.
She did improved later, especially in Johto being one of her stronger points in that saga. Especially in master Quest where writers seemed to start picking things up giving her much better treatment. And as result of that Misty herself in characterization and interactions also was much more lively and showed fruits of her granted slow but still growth showing up in several episodes both in maturity but her competence as trainer too.
If she was written in whole Johto as it was in 5th season , people would have no issues with her treatment in that region.
But we all know what were real reasons behind middle of Johto being way it was(lack of understanding and vision between writers and higher ups).
It wasn't knocked out, Ash switched out and could use it again. If he had used Pikachu, he would have defeated her in two minutes. Pikachu refusing to fight was a dumb plot device.
Butterfree lost, it was confirmed in episode itself. In canon at end of episode it was stated that both Ash and Misty were completely tied for all intents and purposes. Staryu defeated Butterfree(due to drowning Ash called it back with this being treated as surrender). While PIdgeotto arguably was about to defeat Starmie. But that would only mean 1-1 as total result at that time.
Real question is, could it be that Staryu was actually stronger pokemon than Starmie?
Because based on its speed and competence showed in gym battle but also later in series it sure seemed to be on higher level.
Speaking of Pikachu, it was his decision not wanting to battle Misty due to having sympathy for her, looking back Ash Pikachu was always quite fond of her. Besides it was good call from writers side imo, because it allowed for more engaging and unpredictable outcome at that time. Sure Pikachu due to huge type advantage would win, but this way Misty and Ash chances were evened out.