It's not required to buy the CAT from a Mazda dealership but it is important to ensure the Catalytic Converter installed on your Mazda is an OEM compliant part.
If it was sold to you as a model of Catalytic Converter intended for use in your Mazda Miata, we'll assume it is built for your Mazda and recommend inspecting your Mazda's fuel feedback system.
Inspect any condition which would cause your Mazda to run hot. NOx is created when the internal combustion temperature of an engine exceeds 2500f. The engine runs hot when it runs lean (not enough fuel gets to the engine). Look things that would cause a lean fuel condition such as defective emission sensors and/or vacuum leaks.