Earlier quoted context omitted.
Gogol was Ukrainian though. Lots of references to Ukrainian culture in his early writings as well.
But in "Dead Souls" and elsewhere he never referred to himself as a Ukrainian. He called himself, proudly, Russian, through and through.
Ukraine as a country is a relatively modern construct. Born out of centuries of oppression at the hands of Muscovites. That doesn't mean that Ukrainians didn't exist just because they were called something else in the past.
Anyhow, tons of Gogol's writings reference Ukrainian culture. He was born in a cossack town. Which also happened to be part of the Russian Empire, before the idea of Ukrainian independence became widespread.
Might as well say Italians didn't exist before modern Italy, or deny the Germans' history and existence just because Germany is a relatively modern state.