Design to fit components in small space
Circular PCB board outlines are commonly used inside 4-20mA loop sensors and BLDC fan controllers, it's just a matter of using a circular board outline that fits inside the housing (instead of the usual "coupon" rectangular board outline). Depending on your CAD layout software, you may have to search out which layer is the "cutting" layer for defining the board outline.

Be sure to note any components that are greater than 4mm height and ensure those go towards the taller area of the housing. Essentially one side of the board becomes a "keep out" area against the taller components.

Flex PCB can work, but requires board stiffeners underneath the areas where the components are mounted. In my experience there's also some reliability/assembly issues with using flex with components mounted. Flex PCB doesn't behave quite like the usual FR4-type PCB, be sure to check whether your contract manufacturer can successfully assemble these; they're much less common.