The flange and drain pipe are not all one piece. The flange is solvent welded into the closet bend which in turn is solvent welded to the drain line. FYI, this is not PVC pipe, it is ABS pipe. Both are a man-made plastic, but have different chemical properties and are not "glued" in the usual sense of the word. The so-called glue is a solvent that chemically melts the top surfaces of the pipe and fitting so that the will slip together. This causes the two surfaces to combine and when the solvent evaporates, it is actually welded together. OK, now to you problem. Call a plumber. He can cut out the old flange with special tools and install a new one. For a plumber, it's an easy job.