ELF shared libraries - motivation for the PLT

I suppose we're talking about x86 architecture.

You cannot have Self-Modifying Code in protected mode, which is used by most UNIX-based operating systems (and not only) that I'm aware of, because the code segments are always read-only. A loader does not control that -it is something that is being handled by the memory management subsystem of the kernel.

But even if you could "create the code for that table at load time" as you say, it would defy the whole purpose of shared libraries. This way, each process would have a "private" copy of the library's functions in its address space, effectively increasing its memory footprint -one of the reasons that shared libraries were created, was to address this issue.

The whole process you that you describe is quite complex, and it would cost more processing cycles than the PLT method that is used nowadays, and probably would introduce more, new & interesting security issues.