We know that the Apollo astronauts were subject to rigorous medical testing prior to launch, and we know that this caused at least one Apollo crew member to be replaced very late in the process.
However, what if something still happened during the actual spaceflight which prevented a crew member from fulfilling their mission role? Were there contingency plans in place for such a scenario, or was it considered unlikely enough to not warrant specific planning beyond something like "if that happens, we'll just grab the backup crew member, drop them in a chair next to CAPCOM and say 'sort this out'"?
It has been claimed that the Apollo CM was designed such that the command module pilot alone could fly the CSM back to Earth in the event that the lunar-landing mission failed. Given that the CSM was completely separate during the lunar-landing phase of the mission, that makes very good sense; lots of things could go wrong during that phase of the mission, and losing two astronauts was less bad compared to losing three.
Was the lunar module designed and the people involved trained similarly, such that in the event of a crew member problem among the lunar landing crew while on the lunar surface, either lunar-landing astronaut (commander or lunar module pilot) could at the very least ascend from the lunar surface and execute a successful rendezvous with the manned command module?
The inspiration for this question was a comment by Anthony X, which doesn't appear to have received any followup.