I can see advantages to the urea method, which I also presume is heated in order to drive the reaction. Urea is not terribly reactive toward phthalic anhydride (I presume).
The original poster stopped their mechanism with a reactive intermediate. Phthalimide itself is quite acid stable because two carbonyl groups remove electron density from the nitrogen. The intermediate is a protonated nitrogen with two carbonyl groups. It should have a low pKa and could easily protonate the neighboring carboxylate. That would give a more easily cyclizable nitrogen to the carboxylic acid.
The mechanism still has a ways to go. The tetrahedral intermediate can kick out an OH(-). This can remove the proton from the nitrogen to give water. Water can attack one of the three C=O groups. The productive one is the CONH2-group. It will release phthalimide anion (the weakest base) and a protonated carbamic acid. Proton transfer will give phthalimide and carbamic acid. Carbamic acid can decompose to CO2 and NH3.
I am assuming that phthalimide is an Organic Synthesis prep and has been done with either urea or ammonia. I think if you use the ammonia method, you may require more heat or more careful conditions. As pointed out by zaphraud, a stream of ammonia can accomplish the reaction. However, I think an excess of ammonia can retard the reaction. If ammonia is used, it can deprotonate the intermediate amide/carboxylic acid (or protonated amide/carboxylate). This will reduce the reactivity of the neighboring carboxylic acid. I'm sure this can be overcome by heating, but if you are streaming in ammonia, you can slow the reaction.
On the other side of the reaction, phthalimide is base labile. If you continue to stream in ammonia, it can begin to open the phthalimide to give a diamide. This can be reversed by heating. Overall, the urea method looks pretty good. You can purchase urea in a bottle, weigh it on a balance, heat the two together and the by-products are gases.
I find that mechanisms for reactions that use a lot of heat can look awkward. It seems implausible that an ammonium carboxylate should react to give an amide plus water. The normal reaction of a carboxylic acid and an amine is an ammonium salt of the carboxylate. I write them by reversing the acid-base reaction to give the less favorable reactants and have them react.