You can do it with the Traditional Chinese Keyboard, but not the simplified one.
- Open the Settings app in Windows 11
- Click on Time & Language > Language & region > Add a language
- Search for "Chinese (Traditional)" and select it
- Click on "Options" and select "Add a keyboard"
- Select "Microsoft Bopomofo" as the keyboard
- Under "Microsoft Bopomofo," select "keyboard options" > Key assignment
- Under "Select your preferred keyboard layout," change "Standard" to "HanYu Pinyin"