-- Since it would seem that get_widget_by_id is still an open issue (https://github.com/awesomeWM/awesome/issues/2945, https://github.com/awesomeWM/awesome/issues/2181), this abomination is the nuclear solution to finding **ALL** widgets that don't get indexed because they are separated by an already instantiated widget. If you use this, please, use it carefully. Don't call it more than you really need, cache the results if you have to.
-- Hypothetically, if there occurs such a thing as widget cycle, this will get stuck. Also it's very expensive.
return function(widget, id)
    local results = {}
    local checked = {}
    local function walker(widget, id)
        if widget.children then
            for _,v in pairs(widget:get_children()) do
                if (v.id == id) and (not checked[v]) then
                    table.insert(results, v)
                    checked[v] = true
                end
                if (v._private.by_id and v._private.by_id[id]) then
                    for _,v2 in pairs(v._private.by_id[id]) do
                        if not checked[v2] then
                            table.insert(results,v2)
                            checked[v2] = true
                        end
                    end
                end
                walker(v, id)
            end
        end
    end
    walker(widget, id)
    return results
end


