Compact Chainring (50-34) with 11-40 cassette (XT/XTR)

I might be wrong but I think you could get a similar end result with a GRX chainset and front mech?