How use eval to define macros that involve function definitions

I want to define a bunch of macros that define function methods in a private module.

module MyModule

function f() end
function g() end

end

using Main.MyModule

struct T
    i
end

macro f(T, expr)
    esc(:(MyModule.f(::$T) = $expr))
end

@f T "test"

julia> MyModule.f(T(1))
"test"

That works fine if I do it manually. If I try to do this in an eval loop, if fails

for fn in (:f, :g)
    Core.eval(@__MODULE__, quote
        macro $fn(T, expr)
          esc(:($(MyModule.$fn)(::$T) = $expr))
        end
    end)
end

The macro call fails:

julia> @f T "test"
ERROR: syntax: invalid function name "MyModule.f" around REPL[36]:1
Stacktrace:
 [1] top-level scope
   @ REPL[36]:1

I played around with QuoteNodes, but I couldn’t solve this problem.
It feels a bit similar like the discussion in Can't initalize a function with no methods inside a macro · Issue #34164 · JuliaLang/julia · GitHub

Anyone who can help here?