Or fumbles backwards out of their end zone it’s a safety and they punt it away so change of possession and 2 pts. If the offense fumbles out of their opponents end zone they lose possession. If the defense commits a penalty in the end zone it’s ball at the one yard line for the offense.
The rules for the game all change when the end zone is involved, because the end zone is not the same as the regular field of play, and it’s appropriate to treat it differently IMO