to work with any domain, just put a rule that is "In the case that does not start with any language, redirects to / is /"
RewriteEngine on
RewriteRule ^(?!es|en|br)(.*) /es/$1/$2 [R=301,L]
# RewriteRule ^(es|en|br/)(.*) $1$2 [R=301,L]
The second rule is commented, it is just the opposite and leave it just in case.
It would be good to also pass in the options, the option QSA
that indicates that if a query string
comes, it is appended to the URL. But this already depends on your application
PS: tested with Htaccess Tester