How to intercept requests and replace different cookies in a Google Chrome extension?

I use onBeforeSendHeaders to intercept requests, and I define cookies for different users. In the method, I iterate through them to replace the original request’s cookies, then use the sendRequest method to resend the modified request.

chrome.webRequest.onBeforeSendHeaders.addListener(function(details) {
  if (details.initiator && details.initiator.includes(chrome.runtime.id)) {
    return;
  }
  const url = new URL(details.url);
  if (url.host === host) {
    const method = details.method;
    const headers = details.requestHeaders;

    const headersAndCookies = {
      'adminHeaders': admin_cookie,
      'orgAdminHeaders': orgAdmin_cookie,
      'projAdminHeaders': projAdmin_cookie,
      'trainHeaders': train_cookie,
      'noneHeaders': none_cookie,
    };

    for (const [headerName, cookieValue] of Object.entries(headersAndCookies)) {
      let modifiedHeaders = {};
      for (const header of headers) {
        modifiedHeaders[header.name] = header.value;
      }
      modifiedHeaders['Cookie'] = cookieValue;
      
      console.log(`${headerName} cookie:${url}`);
      sendRequest(url, method, modifiedHeaders, body);
    }
  }
},
{
  urls: ['<all_urls>'],
  types: ['xmlhttprequest']
},
['blocking', 'requestHeaders', 'extraHeaders']);

sendRequest:

function sendRequest(u_url, u_method, u_headers, u_body) {
  console.log(u_headers)
  fetch(u_url, {
    method: u_method,
    body: u_body,
    headers: u_headers,
  })
  .then(response => {
    if (!response.ok) {
      throw new Error('Network response was not ok');
    }
    return response.json(); 
  })
  .then(data => {
    console.log(data);
  })
  .catch(error => {
    console.error('There was a problem with the fetch operation:', error);
  });
}

The expected behavior is that the cookies in the new request sent through the browser should be the replaced ones. However, upon comparison, it was found that the cookies in the requests sent again using the sendRequest method still match the original cookies intercepted from the source request. Where could the problem lie? I am puzzled because the cookies logged through console.log appear to be correct.