You can add the following code to the WP Dashboard > Divi > Theme Options > Integration Tab > Add code to the <head> section option:
<script>
jQuery( document ).ready(function() {
jQuery('#top-menu a').click(function(){
let hash = jQuery(this).attr('href').split('#')[1];
window.location.hash = hash;
});
});
</script>