Opinion forming:
Isn't this a way to invite volatility into the Rails ecosystem? Maybe instead of adding options for webpack, yarn etc. Rails should decouple itself from the front-end so that most of us can use our Preferred approach™
Alternately something in the vein of moonglum's gem [0] should also work but again, as an external lib. not part of Rails.
[0] - https://github.com/fejo-dk/rails_external_asset_pipeline