I'd only think it acceptable if experience is superficial, like dark souls, State of Decay or Dying Light. In these games, getting experience and leveling up has interesting perks to them, but are in the end unnecessary to progress through the game. In Dying Light and Dark souls you lose either your held, unspent experience in the case of dark souls or else a % of your survival experience in dying light, (and in state of decay death is permanent, so you not only lose all of that persons experience but him or her as well.) but all of these games can be beaten without leveling your character once throughout the course of the game depending on the skill and tenacity of the player, so while making mistakes and losing levels (or people) is a setback, it's a setback that can be overcome regardless of when it occurs.
In contrast, in more typical rpgs such as Legend of Legaia and Dragonquest, where the player's ability to win or lose a battle is deeply dependent on their character's level and the stat increases and skills involved in those levels I'd be more hesitant of deleveling the player as a punishment for loss since the loss can result just as much from a lack of experience if not more than the skill of the player. In this scenario deleveling could create a vicious, unwinnable cycle if the developer isn't careful about how they implement it.
Edit: on the above example, maybe have stats that effect stealth and stats that affect combat, and add and subtract them based on the player's choices. Choosing how you want to play and what stats level as a result is more fun in most cases than arbitrarily punishing players for an action you allowed them to choose. I hate when devs have a 'right' choice and a 'wrong' (unless it's really well thought out like the serial killer quest in the witcher 3) because it invalidates any reason to give the player a choice in the first place.