Pyright 1.1.375 included a change for #8641 that was incorrect. This change should be reverted and alternative solutions for the original bug explored.
See this thread in the Python typing forum for Jelle's explanation for why pyright's current behavior is incorrect.