Since rMW3a52a5fe87af: User: Reduce locking severity of ::getInstanceForUpdate() it doesn't exactly return an instance for update. It should be replaced with a "get primary instance" method and maybe "get primary instance with shared lock" / "get primary instance with exclusive lock" methods, if those are really needed. Most call sites seem to only change user options which is a separate table; I don't think there is a point in locking the user table row for that.
See also:
T405225: Selenium failures due to "Error 1213 from MediaWiki\Deferred\UserEditCountUpdate::doUpdate, Deadlock found when trying to get lock; try restarting transaction"
{T405112}