What is the best way to build a box to elevate my bathroom fan above joists?
Great idea.

I would install 2x blocking to mimic how it would mount normally and then create a chute using rectangular duct.

Rectangular duct is available, pre bent with 1 bend, you buy 2 to assemble.  You can buy a slightly larger size and just tape the overlap to get a custom size.  Be sure to use a metallic tape and not ordinary "duct" tape.

Make your chute several inches longer (than needed) and cut down along the corner seams to be able to bend out 1" mounting flanges on each end. 

You may need to make some mounting ears to attach the grille.  Perhaps a pair of screws left proud of the chute would catch the spring loaded bail (bale?).