I don't think that they are necessary per se, but can be a valuable, useful experience, provided they don't frighten you out of your wits, or scare you off trying again. I have never had 'a bad trip', but have certainly had some anxious moments, and had some rather scary experiences... and, thinking back on it, most times it was because I 'tempted fate' and actually arranged them even, as a test of nerve, or (most silly) to impress friends - a sort of 'dare game'. I can certainly remember enjoying the adrenaline thrill and excitement, rather like a little kid, then the triumphant joy and satisfaction of getting away with something, or achieving some goal. It has been a long time now, and although I remember the thrilling sensation, I can only remember a few actual incidents. One was a visit to a local park, after some very strong, edgy acid... and a couple of lines of coke, and some strong weed.... first time taking such a nerve jangling combination, only the second time I'd done coke IIRC? There were three of us, 18 yrs old nad all rather nervous and jumpy, geeing each other up and not wanting to seem wimpish - competition is a bad thing for the inexperienced tripper! While smoking a joint on this hillside, a police Range Rover appeared, creeping through the park ... to us, it was like a T Rex, terrifying! But we stayed put (probably the sensible thing to do), and there was certainly that childish sense of 'dares'... until the bastards suddenly turned onto the grass, heading straight for us at high speed, and turned their spotlights on us, and on went the blues and twos. It felt rather like that Tiger tank approaching in Saving Private Ryan... but farmore frightening, and more unfriendly!
Not only were we tripping off our heads, one of the others had half an ounce of dope and some coke in his pocket, and I recall this highly confused, panic stricken run through the dark trees and bushes, then my friend searching desperately for his dope to chuck it... of course, as always in such moments, it took ages, and when he went to throw it, for some reason I said "no, don't waste it... give it to me!", which he did, then as we crept home we had to walk past a police car, and I lost my nerve and swallowed it... after a revolting, LSD mouthed chew, which seemed to last for hours. Not a good idea...
Other times I recall wandering through some pitch dark, notoriously haunted woods at college, and almost plunging forty or fifty feet into this amphitheatre - no guard rails. Exciting wasn't the word... stupid was if I'm honest. No ghost of course. I think it has something to do with that LSD state I felt back then, I was literally like a child in a new, strange world, which I was keen to explore, seeing previously familiar things in an entirely different, utterly fascinating way.
Therefore I'd say every trip was and is a learning experience, whether good, bad, or a mixture of both.