rexml gem is a bundled gem since Ruby 3.0.0.
So you must add rexml to Gemfile.
On Ruby 2.6 and 2.7, rexml gem is default gem.
So default rexml is used if Gemfile does not include rexml.
On these versions of ruby, you must add rexml to Gemfile only if you want to use specific rexml version.