[MemoryBuiltins] Clean up strdup handling (NFCI) (#246693)
Now that strdup/strndup are the only allocators that still need special
handling, remove unnecessary genericity from the code.
We only need to actually handle strdup/strndup in one place, which is
getAllocSize(), so keep things local to that code.