Depending on the application, the primer coats can fulfill a couple other requirements as well:
If you want a really smooth topcoat, you usually want to sand past what you can reasonably/economically/effectively do on the substrate. Some primers are formulated to sand nicely to a powder (as opposed to balling up in clumps on the paper). You'll see this spraying higher quality paint grade work. You have to have a decent surface before you prime, but the primer can really smooth it out for the topcoat.
If you're finishing pine with knots in it, you'll want a primer that will seal the knots, otherwise the pitch will eventually bleed through and discolor the topcoat. Shellac excels at this.
Shellac is also outstanding as a sanding sealer. You can use that in a couple of ways: to fill the pores in the wood so they don't get full of sanding dust (which can be key if you have inlay of strongly contrasting woods), or to stiffen the fibers of softer woods so you can get a better/smoother sanded surface for the next steps in the finishing schedule.
Shellac is also often used as a barrier coat between otherwise incompatible finishes or when you have a relatively fragile stain layer. If you're putting an oil based finish over an oil based stain, you run the risk of picking up the stain as you apply the topcoat, especially if you're brushing or wiping the topcoat. Because the solvent in shellac is alcohol, you can pretty freely brush it over oil or water based stains without risking a disaster.
And yes, I do use primers other than shellac from time to time if I have a specific need, but dewaxed shellac is compatible with basically everything, so I always have a can around.
N.B. I'm not a professional finisher. Don't take my word on any of this; test your prep and finishing schedule on scrap!