If I were to amend the soil, I would only do it with a top dressing of aged
compost. That will feed the biology and release nutrients as needed.
That said, some plants do have natural life spans and then die off. I am unsure of the natural life span of rosemary, but it seems taking cuttings and regrowing them seems to be working. So, I would stick to what works and ignore all the cost and hassle of trying to figure something out. That's just me though. I enjoy spending as much time as possible enjoying my garden and as little as possible working on it.
If it is indeed a nutrient imbalance, you may be able to pull some things from the bonsai realm since it is potted and in your home. Perhaps making a VERY weak nutrient tea and then spraying it daily would be helpful. Just another thought.
All the best,