Refactor: scheduler: functionize creating action reason string from action
This lets us simplify pe_action_set_flag_reason(), and more efficiently allocate the reason string only when needed.