PostgreSQL - CAST vs :: operator on LATERAL table function
It is a bit weird, yes, but the grammar will only accept something syntactically similar to a function call in a function-in-FROM expression.
So that is indeed a trick you can use if you want an arbitrary expression in a FROM clause: surround it with an unnecessary CAST expression.
PostgreSQL will happily treat anything that looks like a function as a table function in such a context.