Is this situation unique to my company or is this true elsewhere as well? What can a senior engineer do to ensure they don't become irrelevant and replaced by cheap freshers?
Often times tasks are poorly scoped or insufficient research has been done on it. This is where the senior engineer brings his experience in to play to be able to complete it.
To not become irrelevant you need to be familiar not only with the language, but best practices, and external impact and integration of your changes across all levels. Being able to address issues before the QA stage is critical. So it's not just fulfilling the story it's understanding what the story intended to do and possibly revising it.
Knowing how to do something while required is only small part of the overall job.