I was trying to remove some dataelements from a dataset with sections in 2.25 (through the dataset menu) and I noticed the following:
You cannot see them in the dataset menu any more (as expected).
You cannot see them in the section menu any more (as expected).
They still appear in the data entry, when opening the just modified dataset (all cache cleanings done).
I checked the database and it seems that the link between section and dataelement is still there (table sectiondataelements). Possible solutions would be to take this into account or not allow to remove a dataelement from a dataset if it is still assigned to a section.
That behaviour has been reproduced in https://play.dhis2.org/