Humorously(?) I had noticed some of the relevant code in the module was too complicated so I rewrote it by hand (shocking, I know).
And then the LLM rewrote it back to being spaghetti when trying to resolve a merge conflict because it was "my preferred style".
You can't make this stuff up.