The short of it is that generally all unsecured creditors are of equal priority - so, unless the note-holders or vendors have secured debt, they are of equal level with the attorneys’ fees. Anyone with a lien or security interest is senior. Employee salaries (including accrued PTO) are also usually considered senior.
In practice, the parties usually work out an arrangement to pay the lawyers so that they will complete the necessary tasks. A law firm likely won’t do the work if they don’t think they will be paid.