Yeah it's interesting, unless I lean hard on them, AI coding agents will tend to solve problems with a lot of "hedging" by splitting into cases or duplicating code. It is totally fine with infinity special cases and unless you push for it, they will solve most problems with special cases and not generalise or consolidate (gemini, claude code at least both seem to have this behaviour).
I feel like this comes about because it's the optimal strategy for doing robust one-shot "point fixes", but it comes at the cost of long-term codebase heath.
I have noticed this bias towards lots of duplication eventually creates a kind of "ai code soup" that you can only really "fix" or keep working on with AI from that point out.
With the right guidance and hints you can get it to refactor and generalise - and it does it well - but the default style definitely trends to "slop" in my experience so far.