Yeah definitely... many people even now will go to watch a film just because so-and-so is in it...
But that is a HUGE win for the said "so-and-so" because that means people are willing to put up with mediocre, dull or even straight up nonsensical storylines and screenplay just because THEY are in it... it means there is something special that the audience have identified in THEM, as an actor and as a person... whether that's good looks, sex appeal, great screen presence, or just sheer acting talent... it means this actor has successfully shown one or more of these qualities in their movie/s, and that has made the audiences love them enough to spend hard earned money just to watch THEM on the big screen...
When the above starts becoming true for any actor, that means they are on the road to achieving superstar status... if they are able to retain and increase said superstar status (through getting more and more fan following, plus higher and higher collections for their films over the years as a result) then they are on the path to becoming a true megastar...
But make no mistake, even superstars end up giving flops when the storylines, characterisation, screenplay, or other actors in the film aren't up to mark! SRK, Salman, even Amitabh Bacchhan all have films that flopped badly, that too long after they already gained massive fan following and gave a lot of big hits in the past... the importance of a good plot, and an overall strong casting can't be underestimated when it comes to making a hit film... it's just that the bigger superstar the lead actor is, the less these other things matter, as there will always be a significant number of people who'll plan a trip to the theatre and pay good money from their own pocket just to see this particular actor!
It also makes more sense financially to cast a superstar when making a very ambitious or big budget movie, as huge numbers of those same people mentioned above (fans basically) will most likely come along to watch the film , making sure that the budget is not only recovered but that there is also quite a lot of profit gained...
The problem you mentioned comes about when writers/directors/casting people rely simply too much on the superstar, and don't do any of their jobs properly... that's when even the superstars give flops... and if the above keeps happening again and again, it's possible for that elusive superstar status to eventually be lost too! A small number of die-hard fans may stick around to keep watching their substandard movies but the masses will eventually move on to someone who has the superstar qualities, but chooses/recieves good movies.
2