Is there a max number of tx outputs allowed by consensus? It seems good for preventing an UTXO bloat by restricting max number of outputs of TX(or block) can have.
Is there such a restriction? if there is, which part of source code should I read? If not, why not?

Note: What I am asking is not about block size limit or TX size limit, I know those and how those are (implicitly) limiting the number of total outputs in TX (or block), but I think this is kinda roundabout way which limits the number outputs only loosely. Why not more direct restriction?
There is no direct limit on the number of outputs, but transactions can't have more than an allowed amount of weight and this indirectly limits the number of outputs.