There is "coaster brake" mechanism, it consists of not only brake, but also of freewheel. As can be seen in answers in Why there are no or few bicycles with coaster brake and external speed gears? , coaster brake is incompatible with derailleur, because it "requires significant tension on the lower part of the chain when it is applied" while derailleur requires that the lower part of chain is relaxed. The lower part of the chain is tensioned only when pedal is pressed in direction opposite to usual ie, when the brake is pressed. (The usual direction is when pedal tries to accelerate bicycle forward.) So, seems, the problem appears only when the brake is applied. So, brake component of the "coaster brake" is incompatible with derailleur. (This means that pedal brake cannot be installed together with derailleur.) But what about the freewheel component of the "coaster brake"? Can such freewheel mechanism be used on the same wheel together with derailleur? I think it would be a viable thing, because it is noiseless. "Freehub" freewheel mechanism, which uses ratchet, is used nowadays with derailleur, and ratchet produces trilling noise while coasting.
I have seen a video of how coaster brake works,. I feel from the video that the freewheel component of the "coaster brake" can be engineered and produced without the brake component.
Seems, derailleur is most popular gear change mechanism, nowadays. "Coaster brake" is also a popular mechanism, and seems it was relatively even more popular in the past. As I see, despite they both are so popular, the freewheel of "coaster brake" is not adopted for usage with derailleur for some reason, I have never seen such combination of bicycle components. Maybe somebody has tried, thinked about it, but found it impossible?