Override the WordPress default pagination markup

do you mean post archive pagination? The paginate_links() function accepts a type parameter, so if all you need is a ul > li format you could try out something like:

    // archive pagination
    global $wp_query;
    $big = 999999999; // need an unlikely integer

    echo paginate_links( [
        'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
        'format' => '?paged=%#%',
        'current' => max( 1, get_query_var('paged') ),
        'total' => $wp_query->max_num_pages,
        `type`  => 'list',
    ] );

If you need a completely custom markup, you could try setting type param to 'array' and then build whatever you need with a foreach loop.

docs: https://developer.wordpress.org/reference/functions/paginate_links/