A prescriptive easement can only be created if the party claiming the easement by prescription knew that the property did not belong to him, but claimed it as his own. That is what is meant by "using property 'adverse' to the interests of the true owner and using it 'openly, notoriously, and hostile to the property rights of the owner". Unfortunately, since you believed that the retaining wall was on property you owned, but which, in fact, you did not own, a prescriptive easement could not be created.
There is no Statute covering this situation, but I believe that the City cannot compel you to completely take down the retaining wall after so many years - 17 years which you owned the property and whatever number of years your predecessor owned the property. I believe, however, that they could force you to take down the retaining wall to its 5-foot level before you reconstructed it. If I were in your situation, I would use the length of time that the retaining wall has been in existence as a bargaining chip. I would insist, for a while, that I had a right to keep the retaining wall at its 8-foot height, and then, so as to appear as if I were making a concession, I would agree to bring it down to the five-foot height. If the City insists on the complete removal of the retaining wall, then I would engage the services of an Attorney and sue the City, if necessary, in order to keep my retaining wall. The City new of its existence, at least at the five-foot level and said nothing and did nothing. It cannot sit idly by and then when "the spirit moves it", the City just steps in, disregards XXXXX XXXXX that has elapsed and demands the removal of the retaining wall.
Please be kind enough to rate Excellent Service" so that I receive credit for assisting you, it will not cost you anything additional to give me a positive rating, and that is the only way I can receive credit, Thank you for understanding,
Bonus and Positive Feedback on survey is very much appreciated,