First in the event of carpet installation the gap will need to be there for the edges of the carpet to be tucked under.
Carpet or trim first.
Also keeps caulk and paint problems off of the new carpet everybody makes mistakes has accidents.
There are many legitimate reasons to do construction work in the proper sequence.
Is this standard practice or just an opinion.
Flooring is always last except for hardwood laminates i hate the shoe mould look.
Most houses i have seen and designed we always put the trim on top of finish floor except for carpeting.
Both the flooring contractor and trim contractor said to install trim first.
Second drywall would wick up moisture from flooded floors or carpet.
Might as well build it that way from the start.
A really thick shag carpet can make it difficult to judge how high to place the trim.
Trim first spaced 1 2 off the floor and space the tack strips 1 2 out from there.
This gives the carpet installer a place to tuck the edges of the carpet for a nice clean edge.
Carpet layers should be the very last trade on the job.
How to install carpet first.
If you care about doing quality work and not wasting time you paint the walls then install the hard floors cabinetry doors and trim.
I install the flooring first then trim tight to it.
Tile should have a grout line equal to the field of the tile.
There may be instances where you want to put the carpet down first.
Or you may be replacing the baseboards but leaving the carpet.