The Temporary Containers addon[1] does this. Combined with the usual Multi-Account Containers "always open this site in..." mechanism you can have some sites always open in a single container, but all other sites open in temporary containers that get deleted shortly after you close their tab.
[1] https://addons.mozilla.org/en-US/firefox/addon/temporary-con...