This gas water heater (American Standard GSN50T1) has a working T/P-relief valve installed on its side. I also found this unused inlet on top of the heater, under a plastic cover, just above a stamp saying "T&P Valve" and with a threaded male plug inside. Can I connect an expansion tank there? (The manual doesn't even mention this inlet.)
No, the expansion tank should NOT be connected there. BTW according to the manufacturer that's an optional alternative mounting location for the TnP valve if the default side mount isn't suitable.
According to the manual of one expansion tank maker:
The items which should be installed in sequence in the cold water line are (1) the EXPANSION TANK must be installed at least 18 inches away from the cold water inlet fitting on the water heater, ...
I would think that the increased exposure to heat and hotter water of an expansion tank in that top location would at the least degrade the rubber internal membrane faster and might also mess with the internal pressure, putting it out of spec.