Termitophily-the symbiosis of organisms with termite societies-has evolved a disproportionate number of times within the rove beetle subfamily Aleocharinae (Staphylinidae). Among aleocharine termitophiles, defensive (limuloid) and mimetic (physogastric & physothoracic) body forms have evolved convergently, but due to lack of a comprehensive aleocharine phylogeny, the context in which termitophily and associated adaptations evolve is unknown. We present the first example of a robust, morphology-based phylogenetic placement of an exclusively termitophilous tribe, the Termitohospitini. Termitohospitini is recovered to be nested within Myllaenini sensu nov, and sister to Myllaena (new synonymy). Furthermore, we also recovered the small tribe Masuriini nested within Myllaenini sensu nov (new status). Reconstructing ecological transitions within this clade, we present evidence that the stem lineage of Myllaenini sensu nov invaded intertidal marine habitats, the common ancestor for Myllaena + Termitohospitini then transitioned to freshwater riparian habitats, with Termitohospitini alone subsequently shifting to termitophily. We conclude that: (1) Termitohospitini was ancestrally a limuloid-bodied riparian inhabitant; (2) a limuloid form may have been pre-adaptive for defense against host attack during the evolution of termitophily; (3) the strongly tapered abdomen of an ancestral limuloid body was a constraint on the evolution of physogastry, leading to the emergence of the unusual physothoracic body form observed in termitohospitines that likely integrates these obligate termitophiles to life inside termite colonies.