Should a function automatically identify a staircase function? No. That can be quite difficult, especially if your staircase is, let me call it, atypical. And everything always seems to be atypical.
Locating regions where your function is constant might be as simple as looking for sub-sequences of points where the function deviates from a constant by no more than some maximum tolerance. But even that can be challenging to find where the stairs end and to find the locations of transitions, especially if there may be a gradual trend mixed in there. For every simple algorithm to find such a set of stairs, again, I can probably pose a problem case to make it fail.
Thinking... (let me see what I can play around with.)