I finally found the problem myself, and I am sharing it here to help others if they run into the same problem.
The simple module in the question is not saved, because its slug, which lacks the et_pb_ prefix. It works fine when I change $this->slug = 'custom_module' to $this->slug = 'et_pb_custom_module' .
I did not see this rule in my documentation, but I hope they mentioned it somewhere.
Here is the working code for a simple Divi user module:
function custom_divi_register_modules() { if(class_exists('ET_Builder_Module')) { class custom_divi_module extends ET_Builder_Module { public function init() { $this->name = __( 'Custom Module', 'et_builder' ); $this->slug = 'et_pb_custom_module'; $this->fb_support = true; } } new custom_divi_module; } } add_action('et_builder_ready', 'custom_divi_register_modules');
source share