Arnold shapes have an id parameter that you can use to set up custom ID AOVs.
kick -info polymesh.id node: polymesh param: id type: INT default: 0
For example, you can Object ID color mode of the Utility shader to generate an ID AOV.
MtoA doesn’t automatically generate IDs, so you need to use the User Options parameter on the shapes to assign IDs.
If you want to give a group of polygon meshes the same ID, so that they all get the same Object ID color, then you can use override sets.