The CKEditor module allows placing separators and wrappers in the toolbar.
If there are no separators, they are automatically grouped when overflowing.
See the full options here: https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/toolbar.html
You can edit the config file and add dropdown menus using the advanced configuration format.