Mustn’t do_action be accompanied with a function?

The param used in do_action isn’t a function is just a tag that represents the action called, the proper way to use an action is attaching functions with add_action.

You can learn more from https://developer.wordpress.org/reference/functions/do_action/