This is normal behavior. An SSH server is identified by its public key. An SSH server can only have multiple public keys if they're keys of different types (RSA, ECDSA, EdDSA, …). Normally, a given client machine always uses the same key type when talking to a given server (based on the client and server's support list and preferences), so the client always sees the same server key.
You're simulating the use of different SSH clients on the same machine, one that only supports RSA and one that only supports ECDSA. These clients see different server identities. But they share the same
known_hosts file that stores the client's memory of server identities. Let's say you use the RSA client first. It sees that
localhost has a certain RSA public key, asks you to check whether this is correct, and when you say “yes”, it records the key in
~/.ssh/known_hosts. Then, when you run the ECDSA client, it receives the server's ECDSA public key, which does not match what is stored in
~/.ssh/known_hosts. This indicates that something is deeply wrong: possibly an attack, possibly some misconfiguration, possibly that the server has been legitimately reinstalled. The SSH client has no way to know which one it is, so it lets you know and aborts the connection attempt.
If you have different SSH client software on the same machine that don't support the same public key algorithms, you need to make them use different
known_hosts files. OpenSSH does not support having multiple public keys corresponding to the same server, which makes sense since it would be extremely rarely useful but would be very easy to accidentally misuse.