Including time-specific measures
Readers will tend to reference measures like this from the publication date, since that is typically the only information they have.  So if you write today, in 2017, that "five years ago, X happened" (i.e. in 2012), but then the article is not published until 2019 (which would be normal in some fields), then, as you say, the reader will mistakenly guess that X happened in 2014.

As such, I would avoid talking about specific numbers of years.  If the precise year is important, give the year ("in 2012, X happened").  If the year is not important, you can use less specific terms like "recently".

If you are writing for a conference, or another situation where you know for sure when the paper would be published, then such expressions would be more reasonable.  But it still means that a future reader may have to flip back to the article's title page to check the publication date, which can be a little distracting.