R
Will there ever be another entity that extends the program entity (other than executable)? If not, I don't see a lot of purpose to it, and would just store the name field in the executable table instead of having a separate table.
Anyway, after you've recursively built out your hierarchy of nodes, you can just join to the tables you want to pull data for accordingly. For example if you want all executables with their names you just join to it in your final SELECT like so:
WITH RECURSIVE directoryTree (id, name, type, parentId, level, protected, siblingOrder, isDesktop) AS (
SELECT n.id, n.name, n.type, n.parentId, -1, n.protected, n.siblingOrder, 1
FROM node n
WHERE n.name="Desktop" AND n.protected=1
UNION ALL
SELECT n.id, n.name, n.type, n.parentId, level + 1, n.protected, n.siblingOrder, 0
FROM node n
JOIN directoryTree p ON p.id = n.parentId
)
SELECT n.id, n.name, n.type, n.parentId, n.level, n.protected, n.siblingOrder, n.isDesktop, e.id AS executableId, p.name AS programName
FROM directoryTree n
INNER JOIN executable e
ON n.id = e.nodeId
INNER JOIN program p
ON e.programId = p.id
ORDER BY n.level;