The "nagios plugin" you installed probably lists build-essential as a dependency.
The most common reason a package would list build-essential as a dependency is if that package compiles some source code as part of its installation procedure. Depending on build-essential is not common practice for packages provided by Ubuntu itself, which on the rare occasions they do require some compilation during install, would not include all of build-essential.
Assuming it's listed as a "requires" dependency there is no way to remove the dependency but leave the package that depends on it using APT. This is a constraint that is enforced by APT for the entire time the package is installed.
In theory if the build tools were only required when the package was installed but are no longer being used, you could forcibly remove the various files belonging to build-essential and things would probably continue to work. But this is definitely not recommended as it will leave you with a system that, as far as APT/dpkg are concerned, is broken!
You say that you don't want build tools on a production server. Is this for security reasons? Because if so, simply not having particular tools available does not really enforce security. For one, build tools don't give ordinary users any extra privileges - they're still restricted to the same parts of the filesystem they would be anyway. They couldn't, for example, install code to run as superuser. Also, regardless of what's installed system-wide a user could still install and run binary tools (such as compilers) inside his or her own home directories with their user privileges.