Opam uninstall fails to clean up empty directories

I’ve stumbled upon a small issue while toying with an opam package for managing a Frama-C plug-in. In essence, such a plug-in is supposed to install a META file in a subdirectory of Frama-C’s own lib/plugins directory, so that it is loaded automatically when the main tool is launched. With the following setup, everything is fine:

dune-project :

(lang dune 3.8)

(name frama-c-empty)

(generate_opam_files true)

(using dune_site 0.1)

(package
 (name frama-c-empty)
 (depends
  "frama-c"
 )
)

dune:

(library
  (name empty)
  (public_name frama-c-empty)
)

(plugin
  (name empty) (libraries frama-c-empty) (site (frama-c plugins))
)

frama-c-empty.opam.template:

name: "frama-c-empty"

empty.ml:

let () = print_endline "Hello, World"

With a fresh opam switch having frama-c.27.0 installed, I can do

dune build @install
dune exec -- frama-c # prints Hello, World as expected
dune install
frama-c # also prints Hello, World
dune uninstall
frama-c # prints nothing

however, if i try to install the plug-in as an opam package, things go wrong when I uninstall it:

opam install .
frama-c # prints Hello, World
opam uninstall frama-c-empty
frama-c # crashes, claiming that The plugin "empty" can't be found

The issue seems to be that opam uninstall in fact leaves the empty directory in lib/frama-c/plugins. Admittedly, Frama-C could check whether this directory contains a proper META file, but shouldn’t opam remove it during uninstallation?