My question is, should I route out the back before applying the stain and finish so that the groove left by the router is also finished
Just on a technical front this groove being finished imparts no advantage to the piece. Non-view surfaces on wooden items are very often left bare and this isn't just small areas or interiors, the complete undersides of tabletops were historically and still are frequently left unfinished.
or would it be okay to rout it out after stain and finish?
I don't think you'd want to. Some prefinishing can be advantageous in certain situations (e.g. for what will become hard-to-reach areas after assembly, inside corners, to help seal a surface against glue squeeze-out) but here I can't visualise any gain by doing so.
And potentially you risk damaging the finish on the front when securing the piece for safe routing. There is probably a greater risk to the finish on the back as mentioned in one of the Comments, but that doesn't really matter since nobody will be looking at the back.