I have heard many times from junior developers that they are working on a project that is not important. This is demotivating a lot when you do some work just to be thrown away after some while. It is just like digging a hole and next day bury it. (Unless, of course, you are a sexton, in which case it makes sense. But that is a different story.)
Once I met a person, who was working on algo-trading algorithms. This is when computers perform tradings and compete with each other executing stock and money trading in milliseconds. He was paid well, the mathematical background was interesting and creating the algorithms was a challenge for him. However he claimed not seeing too much of value of his work to the advantage of the human mankind. He said algo-trading was just machines trading with other machines and nothing else.
We were on a long train travel and had time to discuss, and I explained that algo-trading is a form of competition but not between machines rather between the people who create, execute, maintain the trading. This way algo-trading is an essential part of the evolution that our economy is based on, in my view it may also add to the money liquidity that help the money flow where it really is needed to support investment and innovation.
This person was open to embrace my ideas and was happy seeing that there is more result of his work than just getting the salary. After a half year we met again just by accident (both of us traveled frequently between Budapest and Zürich) and explained that since he believes that his work has real value he is not only happier but also sees the algorithms from a different point of view resulting more success.
Although I believe that the statement above is partly fairy tale, partly result of auto suggestion it still has an important point. You will work better if you know what the meaning of your work is. Being agnostic I know that the life is pointless generally, so the above means that it is only the level how deep you have to dig to find meaning. If you are a shallow person getting paid may make the job important. If you think more complex you want to know what good your work does for the company and through that to the shareholders. If you are a humanistic type you have to know what your work advances humanity, human mankind general. (Be aware not to dig deeper than that risking mental illnesses.)
However what you really have to do: understand the meaning of your work, otherwise it will be no benefit for anybody. Seniors know it.