This merges #94204 with the only difference being that I modified the history into three commits that should be easier to review and understand. Original history: 3524f4cfa94744bf5058bed6f2e3f6490f4c8e1b Modified history: df267a4cca
df267a4cca