Is this by design, or would this be a security issue that should be fixed (by not logging or obfuscating the importprivkey command)?
This point has been discussed in the past. There's no easy way to 'fix' this...
First, note that the same issue arises when you use Electrum (or bitcoind) from the command line;
if you are not careful, private keys will end up in your bash_history (or wherever your OS stores shell histories).
Thus, the Electrum python console does not create a new risk, with respect to that issue; it only displaces the risk.
It would indeed be possible to obfuscate commands like importprivkey in the history. However, the user can do something like this:
mykey="foo"
...
importprivkey(mykey)
... and this can be varied ad infinitum; there's no way to predict all the possible ways to use the console.
Therefore, obfuscating some commands will never be 100% safe, because the very point of this console is to be programmable.
The console is useful for debugging and programming Electrum; thus, I am assuming that users who use the python console instead of the gui are geek types, so they are able to understand that issue. But if you have a better solution, please let me know.