Topology optimization of multicomponent optomechanical systems for improved optical performance