I've seen this feature in many graveyard walls - the thinking behind it is thus.
The entrance gates to graveyards are usually kept locked to prevent animals straying in, therefore if access is required by realatives of the deceased, they need some way of accessing the site and the built-in steps serve that purpose