upgrade: fix expansion of options for top-level formula objects

Fixes #20045.