You can buy top-side covers for recessed lighting, install and seal the perimeter with a fire-proof sealant.
These fire proof cardboard style boxes with the fireproof sealer were used in Australia for maybe 2 or 3 years on the dichoric range of downlights which were a really bad fire hazard.
Another twist was to use a rolled gal metal tube around 300mm high with an open end at the top.
Whole idea was to keep some isolation especially from any ceiling insulation as the mobs who put this stuff in were, well, not really high school educated.
50w of pure danger BUT installed in their millions, thankfully all but disappeared now.
Other lawful requirements were the transformer had to be mounted external to the "box" preferrably on top.
Also, minimum distances from any timber or combustible material had to be strictly maintained.
Was a bit of a contradiction really as the lamp and it's holder could be installed directly in VJ timber ceilings.
BUT there ya go.
Minimum distances are still enforced to this day even though the LED circus is in town.