Putting a hub this diameter into a 20-inch bicycle rim will cause severe spoke angles. It will work, so no problem doing that. I just wanted to let you know that a 17-inch moped rim/tire is a similar size to a 20-inch bicycle, and it's worth considering.
Moped and motorcycle rims have angled nipple holes, so they can be laced with severe spoke angles without stressing the spoke. A 2-inch wide steel motorcycle rim is unnecessarily heavy, but...a fairly light aluminum moped rim about 1.6-inches wide will comfortably seat tires from 2.4 to 3.2-inches wide.
https://www.electricbike.com/moped-rims-tires-hubmotors/