I am a professional artist with a BFA in painting and print-making, a minor (BA) in art history and a MFA in visual studies. I've also taught undergraduate art history survey courses more times than I can count. I'm sure an actual art historian can offer some more insight but I'd just like to jump in with a few tidbits.
What you say is true to a certain degree. In a nutshell, the reasons why people (mostly) created works of art prior to the modern era were to uphold various societal or religious ideologies. Most successful artists would have a powerful patron, say a king or pope, and the artist would be beholden to a particular viewpoint regarding their subject. This could be history or perhaps biblical allegories, etc. For quite a long time, many artistic representations created in this system were also didactic, i.e. they were meant to instruct the viewer in whatever the subject matter was, be that the passion of Christ or the glory of the current king.
The style in which all this stuff was created was rooted in a renaissance mode of artistic production. That meant that most pro artists would have had a classical education, studying anatomy and technique from the old masters. They would spend years cultivating painting and carving techniques so as to mimic reality as closely (and as faithfully to the patron's wishes) as possible.
Taken with the first point, it would make sense that art would be figurative: if you are trying to portray historical events and ideologies for consumption by the masses, you want it to conform to what people are familiar with and recognize. It also stretches back to renaissance ideas about faithfully portraying God's creation, down to the smallest detail. Of course, this glosses over some other popular forms of art such as portraiture, which were even more similar to the space of photography, but I'm going for broad strokes here.
By the time photography is invented and begins to profligate (mid-1800s) culture itself is already being stirred by the first rumblings of what will be called 'Modernism'. Tried and true techniques and norms are being challenged in many areas, not just art, and new schools of thought and new technologies open up new possibilities. Art begins to break away from the patron/artist model and move towards a commodity market. Artists find themselves freed up to cultivate personal styles and 'self-expression' that have nothing to do with establishment ideologies.
And so it is in this space that impressionists find themselves: new science discoveries were picking apart how our eyes actually view the world, the collapse of the patron/artist model meant that more individualistic styles could be desired and sold, and art's 'purpose' was becoming less didactic and more emotional (even down to the techniques used). Rather than a vehicle for ideologies, art was becoming the vehicle for self-expression that we are familiar with today.
Monet, et al decided to go paint sunlight's effect on the countryside because of all these factors. They felt free to pursue their interests in art, they felt themselves as part of a vanguard of this new direction in art (an avant-garde, if you will), and they were willing to explore and experiment in order to more fully indulge their individual whims.
It is not entirely untrue to say that photography's ability to quickly and accurately capture a scene in the world made such a change possible in art and painting specifically. However, to reduce to simply that reason would be a gross over-simplification and would border on being completely off the mark. The switch from realism to abstraction in art is due to a radically changing world and western culture of which photography is only a small part.
If you look at the work of certain painters in the early nineteenth century, before the invention of photography, you can see that the same tendencies are there; an attempt to capture the actual effects of light, in contrast to academic conventions.
For instance, look at some of the later paintings of Turner or some of the oil sketches (not finished paintings) of Constable. In France, look at the paintings of Corot from the 1820's and 1830's.
So the idea of "from realism towards impressionism" doesn't quite make sense, as impressionist paintings are, if anything, more realistic than the academic landscape paintings that preceded them. They are an attempt to look at the actual effects of light, and how they modify the landscape, or whatever the motif might be.
For instance, Manet was criticised for painting the sea blue in one of his paintings, (just a basic uniform blue) and the faces of his subjects in his painting The balcony look white and pale. It was thought by some that he did this from ignorance, but in fact he was just being true to what his eyes could see. Under certain light conditions (strong sunlight) the sea does look blue and people's faces do look flat. But to the people who were used to the highly stylised and artificial conventions of academic art, (chiaroscuro and softening of forms) it looked wrong.
Even the techniques used were different. Monet and Cezanne would paint plein air using paint straight from the tube, and in some cases, not even onto a ground. This is in contrast to the academic way of painting a picture, where you first paint a ground, then do a grisaille underpainting, and then build up the painting layer by layer, starting with very thin layers of paint, and using the formula of fat into lean. This is how older paintings, like the Mona Lisa, were painted, with lots and lots of layers of very thin paint.
People even today still sometimes struggle with the idea that the way that the camera captures things is different from the way the human eye perceives things, but this is in fact true.
Some painters, like Degas, were obviously influenced by photography, but mainly in the framing and composition of their pictures. Another influence on the Impressionists in the same direction were Japanese prints, which showed flat colours and sometimes off-centred or otherwise unusual compositions.
A good basic introduction to the Impressionists and what they were trying to achieve is in E.H. Gombrich's "The Story of Art", chapter 25, "Permanent Revolution".
So to sum up, it's possible that photography may have had an influence but it was probably a minimal one, since the aim of the artists concerned were not to render objects "photographically", but to explore the actual effects of light on the landscape, as perceived by the human eye, not by a mechanical device, especially as colour photography hardly existed at the time. Also, the tendencies that gave rise to Impressionism already existed before the invention of photography, in the painting of the earlier nineteenth century.