Is there a way to find out the last user operation using Python?
The solution for this particular task may be in using render_pre handler to change a global variable. The first frame has to be rendered anyway, so this is not a very elegant solution, but it will do for my purposes. This particular code has to be executed before every render to reset global variable.

import bpy

render_count = 0 # global variable

def execute_for_single():
    print('executing single frame')
    pass

def execute_for_animation():
    print('executing animation')
    pass

def check_for_animation(context, dummy): # needs 2 arguments to be used in handlers
    global render_count # use global variable
    render_count += 1 # change global variable
    if render_count &lt;= 1: # 1 or less frame is being rendered
        execute_for_single()
    else: # more than 1 frame is being rendered 
        execute_for_animation()
        render_count = 0 # reset global variable
        bpy.app.handlers.render_pre.clear() # reset handler

bpy.app.handlers.render_pre.clear() # just a cleanup before the start
bpy.app.handlers.render_pre.append(check_for_animation)


Also I found this:

bpy.context.active_operator


It returns the last executed operator, but needs the correct context, which I didn't manage to determine for render operators, even using the context override. But I guess for the most other operators it may be helpful.