At least one thing I noticed:
Here getElement().setAttribute("theme", "extended-dialog");
you are setting the theme attribute of the element, but you are using the .extended-dialog class name in your style block. So instead of setting the theme attribute, you probably want setClassName("extended-dialog") or getElement().getClassList().add("extended-dialog"); (both of which should do the same thing).
You’re right, that’s my mistake. Dialog doesn’t implement HasStyle, which means it doesn’t have the setClassName. Updating the class through the element API probably won’t help, either, as the class name will probably not get to the actual Dialog element. As far as I can tell, you’ll need to stick to global styles with Dialogs (see for example here: https://github.com/vaadin/flow/issues/4115 ) but maybe someone will correct me if I’m wrong.