Patents are entirely unrelated to trademarks. I very much doubt that an operating system would be able to infringe on a patent for interconnecting plastic blocks.
An operating system called "LegoOS" might infringe on the trademark of a plastic block company called "LEGO" (though one of the tests is "likelihood of confusion" and it would be hard to confuse the two).