I ran into this before with a Fire Marshal. After speaking with the head engineer at Dormont and Ted Lemoff at the NFPA, I concluded it is ok to pass a flexible appliance connector through the sidewall of an appliance cabinet IF it is sleeved in a conduit to protect it and electrically insulate it. Both ends of the connector must be 'accessible' for inspection and service. However, passing flex connectors through floors, walls, etc. or concealing even one end is strictly forbidden.
All the other code requirements still apply such as shutoff within 6ft., sediment trap, ground union, etc. Some AHJs will concede the flex connector functions as a ground union while others still require it in sch 40 pipe. Since unions are the #1 source of leaks, I'd leave it out if I used a flex connector. Be sure to size the connector as each foot de-rates it and in any case you cannot exceed 3' for a heater. Also, never re-use flex connectors.
In the case with CSST, it can penetrate an appliance cabinet if it, too is sleeved in conduit and electrically insulated from the cabinet.
Keep the fire in the fireplace.