Thank you Eberhard and Andrey for your help. So I added default-jre-headless (which permits to install the correct jdk version) to the depends. But even if default-jre-headless was installed before B, openjdk-11-jre-headless still got installed at the end after B. This is probably because it waits for some reason (triggers?) the end of the setup phase.
I finally added openjdk-11-jre-headless instead, what fixed my issue. However I don't find this nice because with each Debian release, the openjdk version must be set to the one that is really shipped while it is the job of default-jre-headless to manage this. Does that seem an expected behaviour to you or is it a bug? Would there be a better way to do this? Thanks. Fab