It is attractive and the way it was done back in the day. I would be tempted if it was mine to leave it alone and figure by the time the kids are big enough to fall over it they should be smart enough not to.
On the other hand I see your concern about code height and it is a height someone might try sitting on it and going over backwards.
The only thing I can think of that would look remotely correct was suggested above and that would be to remove it build a little short wall below and reinstall it. Might be a bit of a project depending on how it was attached.
Also welcome to the forum.