I wonder how this could ever be implemented in FOSS.
The same way anything is implemented in FOSS. It'll be written into the source. Lots of people will modify the code to disable the backdoors. People will post versions of the software with the backdoors missing, many of which actually still have them or have different backdoors installed. Governments may lead an automated search for software without the backdoors, or may simply ignore it uniless they have a reason to target the individual using it.
In other words, what a fucking mess.