I think it takes the user as an argument, so it could relatively nicely solve the problem (though maybe would be too susceptible to DOS attacks since it requires a new process per connection attempt, although openssh should rate limit anyway?)
HTTPS URLs are inconvenient for private repositories, and username has to be part of SSH URLs that people share when setting up a submodule or linking to a repository.