This question already has an answer here:
Is there a filter or material that allows a variable amount of light through based on intensity? So the brightness of highlights would be reduced, while shadows would be less, or not at all, affected. If such a filter were to exist, it would result in increased dynamic range.
I am not referring to ND filters because, if I understand correctly, they cut light uniformly across a scene. (See Do ND filters increase the dynamic range that a camera can ‘see’?)
A serious problem with this idea that I did not consider earlier is that a filter made from such a material, if it does exist, would ultimately behave as an ND filter because light passes through the filter from all directions (as pointed out by @RomeoNinov).